prev  Menu  next

Random Numbers☆☆

RND-function
RND  The pseudorandom number, where 0≦RND<1
 < Note > RND is a reserved word of Full BASIC.

randomize statement
RANDOMIZE
Sets the starting point of the pseudorandom numbers unpredictable.

[Note]
The sequence of the pseudorandom numbers is global over the whole program.

Example. A program which generates 20 random integers within 1 to 6.

10 RANDOMIZE
20 FOR t=1 TO 20
30   LET n=1+INT(6*RND)
40   PRINT n
50 NEXT t
60 END

If RANDOMIZE in line 10 lacks, this program generates the same sequence for every time.



[Supplement]
The pseudorandom numbers generated by RND-functions are those generated by Mersenne Twister method.
They have precision of 52 bits on the binary or the complex mode.
The algorithm depends on mt19937ar.c by Matsumoto and Nishimura, 2002