| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| 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)
- type family ResolveRandMethod (t :: Symbol) o where ...
- data RandCopyMethodInfo
- randCopy :: (HasCallStack, MonadIO m) => Rand -> m 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
- randNew :: (HasCallStack, MonadIO m) => m Rand
- randNewWithSeed :: (HasCallStack, MonadIO m) => Word32 -> m Rand
- randNewWithSeedArray :: (HasCallStack, MonadIO m) => Word32 -> Word32 -> m Rand
- data RandSetSeedMethodInfo
- randSetSeed :: (HasCallStack, MonadIO m) => Rand -> Word32 -> m ()
- data RandSetSeedArrayMethodInfo
- randSetSeedArray :: (HasCallStack, MonadIO m) => Rand -> Word32 -> Word32 -> m ()
Exported types
Memory-managed wrapper type.
Constructors
| Rand (ManagedPtr Rand) |
Instances
Methods
Click to display all available methods, including inherited ones
type family ResolveRandMethod (t :: Symbol) o where ... Source #
Equations
| ResolveRandMethod "copy" o = RandCopyMethodInfo | |
| ResolveRandMethod "double" o = RandDoubleMethodInfo | |
| ResolveRandMethod "doubleRange" o = RandDoubleRangeMethodInfo | |
| ResolveRandMethod "free" o = RandFreeMethodInfo | |
| ResolveRandMethod "int" o = RandIntMethodInfo | |
| ResolveRandMethod "intRange" o = RandIntRangeMethodInfo | |
| ResolveRandMethod "setSeed" o = RandSetSeedMethodInfo | |
| ResolveRandMethod "setSeedArray" o = RandSetSeedArrayMethodInfo | |
| ResolveRandMethod l o = MethodResolutionFailed l o :: Type |
copy
data RandCopyMethodInfo Source #
Instances
| (signature ~ m Rand, MonadIO m) => OverloadedMethod RandCopyMethodInfo Rand signature Source # | |
Defined in GI.GLib.Structs.Rand Methods overloadedMethod :: Rand -> signature # | |
| OverloadedMethodInfo RandCopyMethodInfo Rand Source # | |
Defined in GI.GLib.Structs.Rand Methods | |
Copies a Rand into a new one with the same exact state as before.
This way you can take a snapshot of the random number generator for
replaying later.
Since: 2.4
double
data RandDoubleMethodInfo Source #
Instances
| (signature ~ m Double, MonadIO m) => OverloadedMethod RandDoubleMethodInfo Rand signature Source # | |
Defined in GI.GLib.Structs.Rand Methods overloadedMethod :: Rand -> signature # | |
| OverloadedMethodInfo RandDoubleMethodInfo Rand Source # | |
Defined in GI.GLib.Structs.Rand Methods | |
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
data RandDoubleRangeMethodInfo Source #
Instances
| (signature ~ (Double -> Double -> m Double), MonadIO m) => OverloadedMethod RandDoubleRangeMethodInfo Rand signature Source # | |
Defined in GI.GLib.Structs.Rand Methods overloadedMethod :: Rand -> signature # | |
| OverloadedMethodInfo RandDoubleRangeMethodInfo Rand Source # | |
Defined in GI.GLib.Structs.Rand Methods | |
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
data RandFreeMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod RandFreeMethodInfo Rand signature Source # | |
Defined in GI.GLib.Structs.Rand Methods overloadedMethod :: Rand -> signature # | |
| OverloadedMethodInfo RandFreeMethodInfo Rand Source # | |
Defined in GI.GLib.Structs.Rand Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rand |
|
| -> m () |
Frees the memory allocated for the Rand.
int
data RandIntMethodInfo Source #
Instances
| (signature ~ m Word32, MonadIO m) => OverloadedMethod RandIntMethodInfo Rand signature Source # | |
Defined in GI.GLib.Structs.Rand Methods overloadedMethod :: Rand -> signature # | |
| OverloadedMethodInfo RandIntMethodInfo Rand Source # | |
Defined in GI.GLib.Structs.Rand Methods | |
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
data RandIntRangeMethodInfo Source #
Instances
| (signature ~ (Int32 -> Int32 -> m Int32), MonadIO m) => OverloadedMethod RandIntRangeMethodInfo Rand signature Source # | |
Defined in GI.GLib.Structs.Rand Methods overloadedMethod :: Rand -> signature # | |
| OverloadedMethodInfo RandIntRangeMethodInfo Rand Source # | |
Defined in GI.GLib.Structs.Rand Methods | |
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].
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Rand | Returns: the new |
Creates a new random number generator initialized with a seed taken
either from /dev/urandom (if existing) or from the current time
(as a fallback).
On Windows, the seed is taken from rand_s().
newWithSeed
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Word32 |
|
| -> m Rand | Returns: the new |
Creates a new random number generator initialized with seed.
newWithSeedArray
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Word32 |
|
| -> Word32 |
|
| -> m Rand | Returns: the new |
Creates a new random number generator initialized with seed.
Since: 2.4
setSeed
data RandSetSeedMethodInfo Source #
Instances
| (signature ~ (Word32 -> m ()), MonadIO m) => OverloadedMethod RandSetSeedMethodInfo Rand signature Source # | |
Defined in GI.GLib.Structs.Rand Methods overloadedMethod :: Rand -> signature # | |
| OverloadedMethodInfo RandSetSeedMethodInfo Rand Source # | |
Defined in GI.GLib.Structs.Rand Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rand |
|
| -> Word32 |
|
| -> m () |
Sets the seed for the random number generator Rand to seed.
setSeedArray
data RandSetSeedArrayMethodInfo Source #
Instances
| (signature ~ (Word32 -> Word32 -> m ()), MonadIO m) => OverloadedMethod RandSetSeedArrayMethodInfo Rand signature Source # | |
Defined in GI.GLib.Structs.Rand Methods overloadedMethod :: Rand -> signature # | |
| OverloadedMethodInfo RandSetSeedArrayMethodInfo Rand Source # | |
Defined in GI.GLib.Structs.Rand Methods | |
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