Google

Go to the first, previous, next, last section, table of contents.


random

random([seed])
seed
return
non-negative integer
  • Generates a random number which is a non-negative integer less than 2^32.
  • If a non zero argument is specified, then after setting it as a random seed, a random number is generated.
  • As the default seed is fixed, the sequence of the random numbers is always the same if a seed is not set.
  • The algorithm is Mersenne Twister (http://www.math.keio.ac.jp/matsumoto/mt.html) by M. Matsumoto and T. Nishimura. The implementation is done also by themselves.
  • The period of the random number sequence is 2^19937-1.
  • One can save the state of the random number generator with mt_save. By loading the state file with mt_load, one can trace a single random number sequence arcoss multiple sessions.
References
section lrandom, section mt_save, mt_load.


Go to the first, previous, next, last section, table of contents.