Module

# Random.LCG

Package
purescript-lcg
Repository
purescript/purescript-lcg

### #SeedSource

``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

• `Eq Seed`
• `Ord Seed`
• `Show Seed`

### #mkSeedSource

``mkSeed :: Int -> Seed``

### #unSeedSource

``unSeed :: Seed -> Int``

### #randomSeedSource

``randomSeed :: Effect Seed``

Create a random seed

### #lcgASource

``lcgA :: Int``

The multiplier: a magic constant for the linear congruential generator

### #lcgCSource

``lcgC :: Int``

The increment: a magic constant for the linear congruential generator

### #lcgMSource

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

### #lcgNextSource

``lcgNext :: Seed -> Seed``

Step the linear congruential generator

### #lcgPerturbSource

``lcgPerturb :: Number -> Seed -> Seed``

Perturb a seed value

Modules
Random.LCG