Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
The GRand struct is an opaque data structure. It should only be accessed through the g_rand_* functions.
- newtype Rand = Rand (ManagedPtr Rand)
- noRand :: Maybe Rand
- data RandDoubleMethodInfo
- randDouble :: (HasCallStack, MonadIO m) => Rand -> m Double
- data RandDoubleRangeMethodInfo
- randDoubleRange :: (HasCallStack, MonadIO m) => Rand -> Double -> Double -> m Double
- data RandFreeMethodInfo
- randFree :: (HasCallStack, MonadIO m) => Rand -> m ()
- data RandIntMethodInfo
- randInt :: (HasCallStack, MonadIO m) => Rand -> m Word32
- data RandIntRangeMethodInfo
- randIntRange :: (HasCallStack, MonadIO m) => Rand -> Int32 -> Int32 -> m Int32
- data RandSetSeedMethodInfo
- randSetSeed :: (HasCallStack, MonadIO m) => Rand -> Word32 -> m ()
- data RandSetSeedArrayMethodInfo
- randSetSeedArray :: (HasCallStack, MonadIO m) => Rand -> Word32 -> Word32 -> m ()
Exported types
Methods
double
data RandDoubleMethodInfo Source #
((~) * signature (m Double), MonadIO m) => MethodInfo * RandDoubleMethodInfo Rand signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Rand |
|
-> m Double | Returns: a random number |
Returns the next random gdouble
from rand_
equally distributed over
the range [0..1).
doubleRange
:: (HasCallStack, MonadIO m) | |
=> Rand |
|
-> Double |
|
-> Double |
|
-> m Double | Returns: a random number |
Returns the next random gdouble
from rand_
equally distributed over
the range [begin
..end
).
free
data RandFreeMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * RandFreeMethodInfo Rand signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Rand |
|
-> m () |
Frees the memory allocated for the Rand
.
int
data RandIntMethodInfo Source #
((~) * signature (m Word32), MonadIO m) => MethodInfo * RandIntMethodInfo Rand signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Rand |
|
-> m Word32 | Returns: a random number |
Returns the next random guint32
from rand_
equally distributed over
the range [0..2^32-1].
intRange
:: (HasCallStack, MonadIO m) | |
=> Rand |
|
-> Int32 |
|
-> Int32 |
|
-> m Int32 | Returns: a random number |
Returns the next random gint32
from rand_
equally distributed over
the range [begin
..end
-1].
setSeed
data RandSetSeedMethodInfo Source #
((~) * signature (Word32 -> m ()), MonadIO m) => MethodInfo * RandSetSeedMethodInfo Rand signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Rand |
|
-> Word32 |
|
-> m () |
Sets the seed for the random number generator Rand
to seed
.
setSeedArray
data RandSetSeedArrayMethodInfo Source #
((~) * signature (Word32 -> Word32 -> m ()), MonadIO m) => MethodInfo * RandSetSeedArrayMethodInfo Rand signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Rand |
|
-> Word32 |
|
-> Word32 |
|
-> m () |
Initializes the random number generator by an array of longs. Array can be of arbitrary size, though only the first 624 values are taken. This function is useful if you have many low entropy seeds, or if you require more then 32 bits of actual entropy for your application.
Since: 2.4