Parameter | Type | Description |
---|---|---|
NUMBER | VALUE(INTEGER) | The upper bound integer. |
VALUE(INTEGER) | A random positive integer. |
This function returns a random integer from 0 up to (but not including) the provided value. The input value, if it is not an integer, is interpreted as an integer.
NOTE: The following code will return different values every time it is executed!
world
{
start()
{
local a;
a = 10;
textln("Generating " + a + " integers from 0 to 9:");
while (a > 0)
{
textln(irandom(10));
a = a - 1;
}
textln("");
a = 10;
textln("Generating " + a + " floats from [0.0, 1.0):");
while (a > 0)
{
textln(frandom());
a = a - 1;
}
textln("");
a = 10;
textln("Generating " + a + " Gaussian floats, mean 0, std. dev. 1:");
while (a > 0)
{
textln(grandom(0, 1));
a = a - 1;
}
quit;
}
}
FRandom() — Returns a random floating-point value.
GRandom() — Returns a random floating-point value with Gaussian distribution.
Authors can expect the distribution of this random number generator to be uniform.
The method of generating random numbers is up to the TAME implementation (Java, JS, etc.), and the generator has not been standardized, yet.
There is currently no way to seed the random number generator for testing purposes, at the time of this writing.