RandomX
Category: Arithmetics
Since engine version: 4.9.1.0 GWE
(extended in 4.9.5.0 CE)
Description
Yields a random value from iVal1 to iVal2. It does not matter, which limit is greater or less.
Syntax
int RandomX
(int iVal1, int iVal2);
Parameters
- iVal1:
[opt]
Range start
- iVal2:
[opt]
Range end
Examples
SetXDir(RandomX(-20,+20));
Sets horizontal speed of the object to a random value between -20 and +20.
Message("Daniel hat %d Brötchen!", 0, RandomX(42,23));
Returns the number of Daniel's random bread rolls. This may be a value from 23 to 42.
flgr, Januar 2002