Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
Safe Haskell | None |
Language | Haskell2010 |
GI.GLib.Structs.Rand
Description
The GRand struct is an opaque data structure. It should only be accessed through the g_rand_* functions.
Synopsis
- newtype Rand = Rand (ManagedPtr Rand)
- noRand :: Maybe Rand
- randDouble :: (HasCallStack, MonadIO m) => Rand -> m Double
- randDoubleRange :: (HasCallStack, MonadIO m) => Rand -> Double -> Double -> m Double
- randFree :: (HasCallStack, MonadIO m) => Rand -> m ()
- randInt :: (HasCallStack, MonadIO m) => Rand -> m Word32
- randIntRange :: (HasCallStack, MonadIO m) => Rand -> Int32 -> Int32 -> m Int32
- randSetSeed :: (HasCallStack, MonadIO m) => Rand -> Word32 -> m ()
- randSetSeedArray :: (HasCallStack, MonadIO m) => Rand -> Word32 -> Word32 -> m ()
Exported types
Memory-managed wrapper type.
Constructors
Rand (ManagedPtr Rand) |
Instances
WrappedPtr Rand Source # | |
Defined in GI.GLib.Structs.Rand |
Methods
double
Arguments
:: (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
Arguments
:: (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
Arguments
:: (HasCallStack, MonadIO m) | |
=> Rand |
|
-> m () |
Frees the memory allocated for the Rand
.
int
Arguments
:: (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
Arguments
:: (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
Arguments
:: (HasCallStack, MonadIO m) | |
=> Rand |
|
-> Word32 |
|
-> m () |
Sets the seed for the random number generator Rand
to seed
.
setSeedArray
Arguments
:: (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