Basement.Alg.XorShift

basement-0.0.16: Foundation scrap box of array & string

License | BSD-style
Safe Haskell | None
Language | Haskell2010

Basement.Alg.XorShift

Description

XorShift variant: Xoroshiro128+ https://en.wikipedia.org/wiki/Xoroshiro128%2B

Xoroshiro128+ is a PRNG that uses a shift/rotate-based linear transformation. This is lar

C implementation at: http://xoroshiro.di.unimi.it/xoroshiro128plus.c

Synopsis

- data State = State !Word64 !Word64
- next :: State -> (Word64 -> State -> a) -> a
- nextDouble :: State -> (Double -> State -> a) -> a
- jump :: State -> State

# Documentation

data State #

State of Xoroshiro128 plus

Constructors

State !Word64 !Word64 |

next :: State -> (Word64 -> State -> a) -> a #

Given a state, call the function `f` with the generated Word64 and the next State

nextDouble :: State -> (Double -> State -> a) -> a #

Same as `next` but give a random value of type Double in the range of [0.0 .. 1.0]

jump :: State -> State #

Jump the state by 2^64 calls of next