RandomGen is an interface to pure pseudo-random number generators.
StdGen is the standard RandomGen instance provided by this library.
Methods
next :: g -> (Int, g)genWord8 :: g -> (Word8, g)genWord16 :: g -> (Word16, g)genWord32 :: g -> (Word32, g)genWord64 :: g -> (Word64, g)genWord32R :: Word32 -> g -> (Word32, g)genWord32R upperBound greturns a Word32 that is uniformly distributed over the range[0, upperBound].genWord64R :: Word64 -> g -> (Word64, g)genWord64R upperBound greturns a Word64 that is uniformly distributed over the range[0, upperBound].genShortByteString :: Int -> g -> (ShortByteString, g)Same as
uniformByteArray False, but for ShortByteString.genShortByteString n greturns a ShortByteString of lengthnfilled with pseudo-random bytes.Note - This function will be removed from the type class in the next major release as it is no longer needed because of unsafeUniformFillMutableByteArray.
unsafeUniformFillMutableByteArray :: MutableByteArray s -> Int -> Int -> g -> ST s gFill in the supplied MutableByteArray with uniformly generated random bytes. This function is unsafe because it is not required to do any bounds checking. For a safe variant use
System.Random.Sateful.uniformFillMutableByteArrayMinstead.Default type class implementation uses defaultUnsafeUniformFillMutableByteArray.
genRange :: g -> (Int, Int)split :: g -> (g, g)
Instances8RandomGen, …
RandomGen StdGenDefined in random-1.3.1 · System.Random.InternalRandomGen SMGenDefined in random-1.3.1 · System.Random.InternalRandomGen SMGenDefined in random-1.3.1 · System.Random.InternalRandomGen g => RandomGen (StateGen g)Defined in random-1.3.1 · System.Random.InternalRandomGen g => RandomGen (AtomicGen g)Defined in random-1.3.1 · System.Random.StatefulRandomGen g => RandomGen (IOGen g)Defined in random-1.3.1 · System.Random.StatefulRandomGen g => RandomGen (STGen g)Defined in random-1.3.1 · System.Random.StatefulRandomGen g => RandomGen (TGen g)Defined in random-1.3.1 · System.Random.Stateful