-
-
Notifications
You must be signed in to change notification settings - Fork 19
irandom
CryoEagle edited this page Dec 27, 2018
·
4 revisions
Returns random whole number from 0 to n
irandom(n)
Argument | Description |
---|---|
int n |
The upper range from which the random number will be selected. |
Returns: Real
This function will return number from 0 to your choosen upper range, it's similar like random(n);
but this will return whole number.
NOTE: This function will return the same value every time the game is run afresh due to the fact that SimplexRpgEngine generates the same initial random seed every time to make debugging code a far easier task. To avoid this behaviour use randomize at the start of your game.
int luck = irandom(3);
int score = 0;
if(luck == 2)
{
score++;
}
This code will select random whole number from 0 to 3 for int
luck, if luck will equals to 3 we add for player +1 score.
Back to number_functions