gsl-random-0.4.5: Bindings the the GSL random number generation facilities.

MaintainerPatrick Perry <>
Safe HaskellNone




Quasi-random number generators.


Data types

newtype QRNG Source


MkQRNG (ForeignPtr QRNG) 


newQRNG :: QRNGType -> Int -> IO QRNGSource

Allocate a new quasi-random number generator of the given type, generating points with the given number of dimensions.

resetQRNG :: QRNG -> IO ()Source

Reset the generator to the beginning of its sequence.


getSample :: QRNG -> Ptr Double -> IO ()Source

Stores the next point from the generator in the given buffer. The space available in the buffer must match the dimension of the generator. The components of the sample will each lie in the range (0,1).

getListSample :: QRNG -> IO [Double]Source

Gets the next sample point as a list.

Auxiliary functions

getName :: QRNG -> IO StringSource

Get the name of the generator.

getDimension :: QRNG -> IO IntSource

The dimension of the sequence.

getSize :: QRNG -> IO Word64Source

Get the size of the generator state, in bytes.

getState :: QRNG -> IO [Word8]Source

Get the generator state.

setState :: QRNG -> [Word8] -> IO ()Source

Set the generator state. The input array should have size equal to getSize of the generator; otherwise, strange things will happen.

Copying state

copyQRNG :: QRNG -> QRNG -> IO ()Source

copyQRNG dst src copies the state from one generator to another. The two generators must have the same type.

cloneQRNG :: QRNG -> IO QRNGSource

Allocate a new quasi-random number generator that is exact copy of another generator.


maxDimension :: QRNGType -> IntSource

The maximum dimension of samples that the given generator supports.