Random number generator (included): Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Icon}} and {{header|Unicon}}: Tweak irregular header markup) |
mNo edit summary |
||
Line 208: | Line 208: | ||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |
||
{{incorrect|Common Lisp|Use CLHS as reference. Function rand is incorrect it should be random .}} |
|||
The easiest way to generate random numbers in Common Lisp is to use the built-in rand function after seeding the random number generator. For example, the first line seeds the random number generator and the second line generates a number from 0 to 9 |
The easiest way to generate random numbers in Common Lisp is to use the built-in rand function after seeding the random number generator. For example, the first line seeds the random number generator and the second line generates a number from 0 to 9 |
||
<lang lisp>(setf *random-state* (make-random-state t)) |
<lang lisp>(setf *random-state* (make-random-state t)) |