Xorshift128Plus-0.1.0.0: Pure haskell implementation of xorshift128plus random number generator.

LicensePublic Commons
Maintainerkanai.hiroki12@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

System.Random.Xorshift128Plus

Description

This module is implementation of xorshift128+ random number generator. Read original implementation and description is strictly recommended.

The generator state is stored in the Gen data type and it is created by initialize function with seed value or calling Gen data constructor with generator state.

To generate random values, first initialize a random number generator by seed value.

  let gen = initialize 3748374974327

Then generate a random number by next or next01.

  let (v, gen') = next gen
  let (v, gen') = next01 gen

Synopsis

Documentation

data Gen Source

Random number generator.

Constructors

Gen !Word64 !Word64 

Instances

initialize :: Word64 -> Gen Source

Create a generator by seed value. Please do not supply 0.

next :: Gen -> (Word64, Gen) Source

Generate a 64bit random value and next generator state.

next01 :: Gen -> (Double, Gen) Source

Generate a random value between 0 and 1. And next generator state.

next# :: Gen -> (#Word64, Gen#) Source

Same as next, but return values with unboxed tuple.