Random number generator (included): Difference between revisions
Random number generator (included) (view source)
Revision as of 15:34, 23 February 2021
, 3 years agoadd Standard ML
m (→{{header|REXX}}: added highlighting.) |
(add Standard ML) |
||
Line 822:
=={{header|Sparkling}}==
Sparkling uses the built-in PRNG of whichever C library implementation the interpreter is compiled against. The Sparkling library functions <tt>random()</tt> and <tt>seed()</tt> map directly to the C standard library functions <tt>rand()</tt> and <tt>srand()</tt> with only one small difference: the return value of <tt>rand()</tt> is divided by <tt>RAND_MAX</tt> so that the generated number is between 0 and 1.
=={{header|Standard ML}}==
The basis library does not include a random number generator.
SML/NJ provides the [https://smlnj.org/doc/smlnj-lib/Util/str-Rand.html Rand] and [https://smlnj.org/doc/smlnj-lib/Util/str-Random.html Random] structures (with a description of the used algorithms in the documentation).
MLton additionally ships with [http://mlton.org/MLtonRandom MLtonRandom], which implements a simple LCG, taken from "[https://www.cec.uchile.cl/cinetica/pcordero/MC_libros/NumericalRecipesinC.pdf Numerical Recipes in C]", page 284 ("An Even Quicker Generator").
=={{header|Stata}}==
|