grand.h File Reference

__G_RAND_H__

Typedef GRand

typedef typedefG_BEGIN_DECLS struct _GRandGRand

g_rand_new_with_seed ( guint32 )

IMPORT_C GRand *g_rand_new_with_seed(guint32seed)

g_rand_new_with_seed: : a value to initialize the random number generator.

Creates a new random number generator initialized with .

Return value: the new GRand.

g_rand_new_with_seed_array ( const guint32 *, guint )

IMPORT_C GRand *g_rand_new_with_seed_array(const guint32 *seed,
guintseed_length
)

g_rand_new_with_seed_array: : an array of seeds to initialize the random number generator. : an array of seeds to initialize the random number generator.

Creates a new random number generator initialized with .

Return value: the new GRand.

Since: 2.4

g_rand_new ( void )

IMPORT_C GRand *g_rand_new(void)

g_rand_new:

Creates a new random number generator initialized with a seed taken either from <filename>/dev/urandom</filename> (if existing) or from the current time (as a fallback).

Return value: the new GRand.

g_rand_free ( GRand * )

IMPORT_C voidg_rand_free(GRand *rand_)

g_rand_free: : a GRand.

Frees the memory allocated for the GRand.

g_rand_copy ( GRand * )

IMPORT_C GRand *g_rand_copy(GRand *rand_)

g_rand_copy: : a GRand.

Copies a GRand 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.

Return value: the new GRand.

Since: 2.4

g_rand_set_seed ( GRand *, guint32 )

IMPORT_C voidg_rand_set_seed(GRand *rand_,
guint32seed
)

g_rand_set_seed: : a GRand. : a value to reinitialize the random number generator.

Sets the seed for the random number generator GRand to .

g_rand_set_seed_array ( GRand *, const guint32 *, guint )

IMPORT_C voidg_rand_set_seed_array(GRand *rand_,
const guint32 *seed,
guintseed_length
)

g_rand_set_seed_array: : a GRand. : array to initialize with : length of array

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 32bits of actual entropy for your application.

Since: 2.4

g_rand_boolean

g_rand_int ( GRand * )

IMPORT_C guint32g_rand_int(GRand *rand_)

g_rand_int: : a GRand.

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

Return value: A random number.

g_rand_int_range ( GRand *, gint32, gint32 )

IMPORT_C gint32g_rand_int_range(GRand *rand_,
gint32begin,
gint32end
)

g_rand_int_range: : a GRand. : lower closed bound of the interval. : upper open bound of the interval.

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

Return value: A random number.

g_rand_double ( GRand * )

IMPORT_C gdoubleg_rand_double(GRand *rand_)

g_rand_double: : a GRand.

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

Return value: A random number.

g_rand_double_range ( GRand *, gdouble, gdouble )

IMPORT_C gdoubleg_rand_double_range(GRand *rand_,
gdoublebegin,
gdoubleend
)

g_rand_double_range: : a GRand. : lower closed bound of the interval. : upper open bound of the interval.

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

Return value: A random number.

g_random_set_seed ( guint32 )

IMPORT_C voidg_random_set_seed(guint32seed)

g_random_set_seed: : a value to reinitialize the global random number generator.

Sets the seed for the global random number generator, which is used by the <function>g_random_*</function> functions, to .

g_random_boolean

g_random_int ( void )

IMPORT_C guint32g_random_int(void)

g_random_int:

Return a random guint32 equally distributed over the range [0..2^32-1].

Return value: A random number.

g_random_int_range ( gint32, gint32 )

IMPORT_C gint32g_random_int_range(gint32begin,
gint32end
)

g_random_int_range: : lower closed bound of the interval. : upper open bound of the interval.

Returns a random gint32 equally distributed over the range [..-1].

Return value: A random number.

g_random_double ( void )

IMPORT_C gdoubleg_random_double(void)

g_random_double:

Returns a random gdouble equally distributed over the range [0..1).

Return value: A random number.

g_random_double_range ( gdouble, gdouble )

IMPORT_C gdoubleg_random_double_range(gdoublebegin,
gdoubleend
)

g_random_double_range: : lower closed bound of the interval. : upper open bound of the interval.

Returns a random gdouble equally distributed over the range [..).

Return value: A random number.