Library for pseudorandom number generation in Curry.
This library provides operations for generating pseudorandom
number sequences.
For any given seed, the sequences generated by the operations
in this module should be identical
to the sequences
generated by the java.util.Random package
.
The KiCS2 implementation is based on an algorithm taken from
http://en.wikipedia.org/wiki/Random_number_generation
.
There is an assumption that all operations are implicitly
executed mod 2^32 (unsigned 32bit integers) !!!
GHC computes between 2^29 and 2^291, thus the sequence
is NOT as random as one would like.
m_w = <chooseinitializer>; /* must not be zero */ m_z = <chooseinitializer>; /* must not be zero */
uint get_random() { m_z = 36969 * (m_z & 65535) + (m_z >> 16); m_w = 18000 * (m_w & 65535) + (m_w >> 16); return (m_z << 16) + m_w; /* 32bit result */ }
The PAKCS implementation is a linear congruential pseudorandom number generator described in Donald E. Knuth, The Art of Computer Programming, Volume 2: Seminumerical Algorithms, section 3.2.1.
Author: Sergio Antoy (with extensions by Michael Hanus)
Version: June 2017
nextInt
:: Int > [Int]
Returns a sequence of pseudorandom, integer values. 
nextIntRange
:: Int > Int > [Int]
Returns a pseudorandom sequence of values between 0 (inclusive) and the specified value (exclusive). 
nextBoolean
:: Int > [Bool]
Returns a pseudorandom sequence of boolean values. 
getRandomSeed
:: IO Int
Returns a timedependent integer number as a seed for really random numbers. 
shuffle
:: Int > [a] > [a]
Computes a random permutation of the given list. 
Returns a sequence of pseudorandom, integer values.

Returns a pseudorandom sequence of values between 0 (inclusive) and the specified value (exclusive).

Returns a pseudorandom sequence of boolean values.

Returns a timedependent integer number as a seed for really random numbers. Should only be used as a seed for pseudorandom number sequence and not as a random number since the precision is limited to milliseconds 
Computes a random permutation of the given list.
