random-variates-0.1.5.1: "Uniform RNG => Non-Uniform RNGs"

Safe HaskellSafe
LanguageHaskell2010

Stochastic.Uniform

Synopsis

Documentation

xorshift128plus :: Integer -> UniformRandom Source

For information on the performance of the xorshift-128-plus PRNG, please see: Vigna et al.

class RandomGen g where

The class RandomGen provides a common interface to random number generators.

Minimal complete definition

next, split

Methods

next :: g -> (Int, g)

The next operation returns an Int that is uniformly distributed in the range returned by genRange (including both end points), and a new generator.

genRange :: g -> (Int, Int)

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).