gi-glib-2.0.25: GLib bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.GLib.Structs.Rand

Description

The GRand struct is an opaque data structure. It should only be accessed through the g_rand_* functions.

Synopsis

Exported types

newtype Rand Source #

Memory-managed wrapper type.

Constructors

Rand (ManagedPtr Rand) 

Instances

Instances details
Eq Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

(==) :: Rand -> Rand -> Bool #

(/=) :: Rand -> Rand -> Bool #

BoxedPtr Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

boxedPtrCopy :: Rand -> IO Rand

boxedPtrFree :: Rand -> IO ()

ManagedPtrNewtype Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

toManagedPtr :: Rand -> ManagedPtr Rand

Methods

Click to display all available methods, including inherited ones

Expand

Methods

double, doubleRange, free, int, intRange.

Getters

None.

Setters

setSeed, setSeedArray.

double

randDouble Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rand

rand_: a Rand

-> m Double

Returns: a random number

Returns the next random gdouble from rand_ equally distributed over the range [0..1).

doubleRange

randDoubleRange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rand

rand_: a Rand

-> Double

begin: lower closed bound of the interval

-> Double

end: upper open bound of the interval

-> m Double

Returns: a random number

Returns the next random gdouble from rand_ equally distributed over the range [begin..end).

free

randFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rand

rand_: a Rand

-> m () 

Frees the memory allocated for the Rand.

int

randInt Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rand

rand_: a Rand

-> m Word32

Returns: a random number

Returns the next random guint32 from rand_ equally distributed over the range [0..2^32-1].

intRange

randIntRange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rand

rand_: a Rand

-> Int32

begin: lower closed bound of the interval

-> Int32

end: upper open bound of the interval

-> m Int32

Returns: a random number

Returns the next random gint32 from rand_ equally distributed over the range [begin..end-1].

setSeed

randSetSeed Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rand

rand_: a Rand

-> Word32

seed: a value to reinitialize the random number generator

-> m () 

Sets the seed for the random number generator Rand to seed.

setSeedArray

randSetSeedArray Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rand

rand_: a Rand

-> Word32

seed: array to initialize with

-> Word32

seedLength: length of array

-> 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