Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- xorshift128plus :: Integer -> UniformRandom
- data UniformRandom
- nWayAllocate :: Integer -> Integer -> UniformRandom -> ([UniformRandom], UniformRandom)
- splitAllocate :: Integer -> UniformRandom -> (UniformRandom, UniformRandom)
- class RandomGen g where
Documentation
xorshift128plus :: Integer -> UniformRandom Source
For information on the performance of the xorshift-128-plus PRNG, please see: Vigna et al.
nWayAllocate :: Integer -> Integer -> UniformRandom -> ([UniformRandom], UniformRandom) Source
splitAllocate :: Integer -> UniformRandom -> (UniformRandom, UniformRandom) Source
class RandomGen g where
The class RandomGen
provides a common interface to random number
generators.
The next
operation returns an Int
that is uniformly distributed
in the range returned by genRange
(including both end points),
and a new generator.
The genRange
operation yields the range of values returned by
the generator.
It is required that:
The second condition ensures that genRange
cannot examine its
argument, and hence the value it returns can be determined only by the
instance of RandomGen
. That in turn allows an implementation to make
a single call to genRange
to establish a generator's range, without
being concerned that the generator returned by (say) next
might have
a different range to the generator passed to next
.
The default definition spans the full range of Int
.
split :: g -> (g, g)
The split
operation allows one to obtain two distinct random number
generators. This is very useful in functional programs (for example, when
passing a random number generator down to recursive calls), but very
little work has been done on statistically robust implementations of
split
([System.Random, System.Random]
are the only examples we know of).