Module "Random.curry"

Library for pseudo-random number generation in Curry.

This library provides operations for generating pseudo-random number sequences. For any given seed, the sequences generated by the operations in this module should be identical to the sequnces generated by the java.util.Random package.

The algorithm is a linear congruential pseudo-random 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: December 2004


 Exported names:

Functions:
getRandomSeed | nextBoolean | nextInt | nextIntRange


 Summary of exported functions:

nextInt  :: Int -> [Int]  deterministic 
          Returns a sequence of pseudorandom, uniformly distributed 32-bits integer values.
nextIntRange  :: Int -> Int -> [Int]  deterministic rigid
          Returns a pseudorandom, uniformly distributed sequence of values between 0 (inclusive) and the specified value (exclusive).
nextBoolean  :: Int -> [Bool]  deterministic 
          Returns a pseudorandom, uniformly distributed sequence of boolean values.
getRandomSeed  :: IO Int  deterministic 
          Returns a time-dependent integer number as a seed for really random numbers.

 Imported modules:

Prelude
System
Time

 Exported datatypes:


 Exported functions:

nextInt :: Int -> [Int]  deterministic 

Returns a sequence of pseudorandom, uniformly distributed 32-bits integer values. All 232 possible integer values are produced with (approximately) equal probability.

Example call:  (nextInt seed)

Parameters:
seed - The seed of the random sequence.

nextIntRange :: Int -> Int -> [Int]  deterministic rigid

Returns a pseudorandom, uniformly distributed sequence of values between 0 (inclusive) and the specified value (exclusive). Each value is a 32-bits positive integer. All n possible values are produced with (approximately) equal probability.

Example call:  (nextIntRange seed n)

Parameters:
seed - The seed of the random sequence.
n - The bound on the random number to be returned. Must be positive.

nextBoolean :: Int -> [Bool]  deterministic 

Returns a pseudorandom, uniformly distributed sequence of boolean values. The values True and False are produced with (approximately) equal probability.

Example call:  (nextBoolean seed)

Parameters:
seed - The seed of the random sequence.

getRandomSeed :: IO Int  deterministic 

Returns a time-dependent 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



Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Jun 16 17:15:16 2009