gi-glib
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
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 #

GBoxed Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

ManagedPtrNewtype Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

TypedObject Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

glibType :: IO GType #

HasParentTypes Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

HasAttributeList Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

(signature ~ m Rand, MonadIO m) => OverloadedMethod RandCopyMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

(signature ~ m Double, MonadIO m) => OverloadedMethod RandDoubleMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

(signature ~ (Double -> Double -> m Double), MonadIO m) => OverloadedMethod RandDoubleRangeMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

(signature ~ m (), MonadIO m) => OverloadedMethod RandFreeMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

(signature ~ m Word32, MonadIO m) => OverloadedMethod RandIntMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

(signature ~ (Int32 -> Int32 -> m Int32), MonadIO m) => OverloadedMethod RandIntRangeMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

(signature ~ (Word32 -> Word32 -> m ()), MonadIO m) => OverloadedMethod RandSetSeedArrayMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

(signature ~ (Word32 -> m ()), MonadIO m) => OverloadedMethod RandSetSeedMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

OverloadedMethodInfo RandCopyMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

OverloadedMethodInfo RandDoubleMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

OverloadedMethodInfo RandDoubleRangeMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

OverloadedMethodInfo RandFreeMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

OverloadedMethodInfo RandIntMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

OverloadedMethodInfo RandIntRangeMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

OverloadedMethodInfo RandSetSeedArrayMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

OverloadedMethodInfo RandSetSeedMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

(info ~ ResolveRandMethod t Rand, OverloadedMethod info Rand p, HasField t Rand p) => HasField (t :: Symbol) Rand (p :: Type) Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

getField :: Rand -> p #

(info ~ ResolveRandMethod t Rand, OverloadedMethodInfo info Rand) => IsLabel t (MethodProxy info Rand) Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

fromLabel :: MethodProxy info Rand #

(info ~ ResolveRandMethod t Rand, OverloadedMethod info Rand p) => IsLabel t (Rand -> p) Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

fromLabel :: Rand -> p #

IsGValue (Maybe Rand) Source #

Convert Rand to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.GLib.Structs.Rand

type AttributeList Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

type ParentTypes Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

type ParentTypes Rand = '[] :: [Type]

Methods

Click to display all available methods, including inherited ones

Expand

Methods

copy, double, doubleRange, free, int, intRange.

Getters

None.

Setters

setSeed, setSeedArray.

copy

data RandCopyMethodInfo Source #

Instances

Instances details
(signature ~ m Rand, MonadIO m) => OverloadedMethod RandCopyMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

OverloadedMethodInfo RandCopyMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

randCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rand

rand_: a Rand

-> m Rand

Returns: the new Rand

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

Instances details
(signature ~ m Double, MonadIO m) => OverloadedMethod RandDoubleMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

OverloadedMethodInfo RandDoubleMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

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

data RandDoubleRangeMethodInfo Source #

Instances

Instances details
(signature ~ (Double -> Double -> m Double), MonadIO m) => OverloadedMethod RandDoubleRangeMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

OverloadedMethodInfo RandDoubleRangeMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

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

data RandFreeMethodInfo Source #

Instances

Instances details
(signature ~ m (), MonadIO m) => OverloadedMethod RandFreeMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

OverloadedMethodInfo RandFreeMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

randFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rand

rand_: a Rand

-> m () 

Frees the memory allocated for the Rand.

int

data RandIntMethodInfo Source #

Instances

Instances details
(signature ~ m Word32, MonadIO m) => OverloadedMethod RandIntMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

OverloadedMethodInfo RandIntMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

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

data RandIntRangeMethodInfo Source #

Instances

Instances details
(signature ~ (Int32 -> Int32 -> m Int32), MonadIO m) => OverloadedMethod RandIntRangeMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

OverloadedMethodInfo RandIntRangeMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

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

new

randNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Rand

Returns: the new Rand

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

randNewWithSeed Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

seed: a value to initialize the random number generator

-> m Rand

Returns: the new Rand

Creates a new random number generator initialized with seed.

newWithSeedArray

randNewWithSeedArray Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

seed: an array of seeds to initialize the random number generator

-> Word32

seedLength: an array of seeds to initialize the random number generator

-> m Rand

Returns: the new Rand

Creates a new random number generator initialized with seed.

Since: 2.4

setSeed

data RandSetSeedMethodInfo Source #

Instances

Instances details
(signature ~ (Word32 -> m ()), MonadIO m) => OverloadedMethod RandSetSeedMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

OverloadedMethodInfo RandSetSeedMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

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

data RandSetSeedArrayMethodInfo Source #

Instances

Instances details
(signature ~ (Word32 -> Word32 -> m ()), MonadIO m) => OverloadedMethod RandSetSeedArrayMethodInfo Rand signature Source # 
Instance details

Defined in GI.GLib.Structs.Rand

Methods

overloadedMethod :: Rand -> signature #

OverloadedMethodInfo RandSetSeedArrayMethodInfo Rand Source # 
Instance details

Defined in GI.GLib.Structs.Rand

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