Core Function Random
From Sputnik Wiki
Random( <minValue>, <maxValue>, <flag> )
Contents |
Description
Get a random number from the defined area.
Parameters
minValue
A number, or a variable containing a number.
$var = 5;
maxValue
A number, or a variable containing a number.
$var2 = 33;
Return Value
Success: Returns a random number.
Failure: Does not return a random number (if an expression is not properly defined).
Remarks
Warning:
The lower bound is inclusive and the upper bound is exclusive.
That means that Random() will return the lower number, but it is guaranteed to never return the upper one.
This means if you wish to generate a random number from 1 to 3 you must request from 1 to 4.
The same goes if you wish to generate a random number from 0.1 to 0.3 you must request from 0.1 to 0.4.
Example
$var = 5; // first expression $var2 = 33; // second expression $ran = Random($var, $var2); // function in variable printf($ran); // print a random number from $ran