Module

Random.LCG

#Seed

newtype Seed

A seed for the linear congruential generator. We omit a Semiring instance because there is no zero value, as 0 is not an acceptable seed for the generator.

Instances

#mkSeed

#unSeed

#randomSeed

randomSeed :: Effect Seed

Create a random seed

#lcgA

lcgA :: Int

The multiplier: a magic constant for the linear congruential generator

#lcgC

lcgC :: Int

The increment: a magic constant for the linear congruential generator

#lcgM

lcgM :: Int

The modulus: a magic constant for the linear congruential generator. It is equal to 2^31 - 1, a Mersenne prime. It is useful for this value to be prime, because then the requirement of the initial seed being coprime to the modulus is satisfied when the seed is between 1 and lcgM - 1.

#lcgNext

lcgNext :: Seed -> Seed

Step the linear congruential generator

#lcgPerturb

lcgPerturb :: Int -> Seed -> Seed

Perturb a seed value

Modules