Original Author Paul Laughton, 2011
Page 57
De Re BASIC!
= 0
0
< 0
-1
RANDOMIZE({<nexp>})
Creates a pseudo-random number generator for use with the RND() function. The optional seed
parameter <nexp> initializes the generator. Omitting the parameter is the same as specifying 0. If you
call RND() without first calling RANDOMIZE(), it is the same as if you had executed RANDOMIZE(0).
A non-zero seed initializes a predictable series of pseudo-random numbers. That is, for a given non-zero
seed value, subsequent RND() calls will always return the same series of values.
If the seed is 0, the sequence of numbers from RND() is unpredictable and not reproducible. However,
repeated RANDOMIZE(0) calls do not produce "more random" sequences.
The RANDOMIZE() function always returns zero.
RND()
Returns a random number generated by the pseudorandom number generator. If a RANDOMIZE(n) has
not been previously executed then a new random generator will be created using RANDOMIZE(0).
The random number will be greater than or equal to zero and less than one. (0 <= n < 1).
d = FLOOR(6 * RND() + 1)
% roll a six-sided die
MAX(<nexp>, <nexp>)
Returns the maximum of two numbers as an <nvar>.
MIN(<nexp>, <nexp>)
Returns the minimum of two numbers as an <nvar>.
CEIL(<nexp>)
Rounds up towards positive infinity. 3.X becomes 4 and -3.X becomes -3.
FLOOR(<nexp>)
Rounds down towards negative infinity. 3.X becomes 3 and -3.X becomes -4.
INT(<nexp>)
Returns the integer part of <nexp>. 3.X becomes 3 and -3.X becomes -3. This operation may also be
called truncation, rounding down, or rounding toward zero.
FRAC(<nexp>)
Returns the fractional part of <nexp>. 3.4 becomes 0.4 and -3.4 becomes -0.4.