All Manuals > LispWorks® User Guide and Reference Manual > 38 The LISPWORKS Package

mt-random Function

Summary

Returns a pseudo-random number using the Mersenne Twister algorithm.

Package

lispworks

Signature

mt-random arg &optional state => random-number

Arguments
arg
A positive integer or a positive float.
state
An object of type mt-random-state. The default is the value of *mt-random-state*.
Values
random-number
A non-negative number less than arg and of the same type as arg.
Description

The function mt-random returns a pseudo-random number which is non-negative, less than arg and is of the same type as arg.

state contains the state of the pseudo-random number generator and is updated.

random-number is generated using the Mersenne Twister algorithm published by Makoto Matsumoto and Takuji Nishimura at
http://www.math.keio.ac.jp/~matumoto/emt.html.

We thank the authors for making the algorithm freely available.

mt-random is analogous to cl:random.

See also

make-mt-random-state
*mt-random-state*


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:41