Random number generator (included): Difference between revisions

Add J
(→‎{{header|Java}}: Note about Math.random())
(Add J)
Line 12:
=={{header|Factor}}==
The default RNG used when the <code>random</code> vocabulary is used, is the [[wp:Mersenne twister|Mersenne twister]] algorithm [http://docs.factorcode.org/content/article-random.html]. But there are other RNGs available, including [[wp:SFMT|SFMT]], the system RNG ([[wp:/dev/random|/dev/random]] on Unix) and [[wp:Blum Blum Shub|Blum Blum Shub]]. It's also very easy to implement your own RNG and integrate it into the system. [http://docs.factorcode.org/content/article-random-protocol.html]
=={{header|J}}==
By default J's <code>?</code> primitive (Roll/Deal) uses the Mersenne twister algorithm, but can be set to use a number of other algorithms as detailed on the [http://www.jsoftware.com/help/dictionary/d640.htm J Dictionary page for Roll/Deal].
 
=={{header|Java}}==
Java's <code>Random</code> class uses a [[wp:Linear congruential generator|Linear congruential formula]], as described in [http://java.sun.com/javase/6/docs/api/java/util/Random.html its documentation]. The commonly used <code>Math.random()</code> uses a <code>Random</code> object under the hood.
892

edits