Safe Haskell | Safe-Inferred |
---|
RandomHBC
Description
This module implements a (good) random number generator.
The June 1988 (v31 #6) issue of the Communications of the ACM has an article by Pierre L'Ecuyer called, Efficient and Portable Combined Random Number Generators. Here is the Portable Combined Generator of L'Ecuyer for 32-bit computers. It has a period of roughly 2.30584e18.
Transliterator: Lennart Augustsson
- randomInts :: Int -> Int -> [Int]
- randomDoubles :: Int -> Int -> [Double]
- normalRandomDoubles :: Int -> Int -> [Double]
Documentation
randomInts :: Int -> Int -> [Int]
Use seeds s1 in 1..2147483562 and s2 in 1..2147483398 to generate an infinite list of random Ints.
randomDoubles :: Int -> Int -> [Double]
Same values for s1 and s2 as above, generates an infinite list of Doubles uniformly distibuted in (0,1).
normalRandomDoubles :: Int -> Int -> [Double]
normalRandomDoubles is given two seeds and returns an infinite list of random normal variates with mean 0 and variance 1. (Box Muller method see Art of Computer Programming Vol 2)