Rand package:gi-glib
The GRand struct is an opaque data structure. It should only be
accessed through the g_rand_* functions.
Memory-managed wrapper type.
Returns a random gdouble equally distributed over the
range [0..1).
Returns a random gdouble equally distributed over the
range [begin..end).
Return a random guint32 equally distributed over the
range [0..2^32-1].
Returns a random gint32 equally distributed over the
range [begin..end-1].
Sets the seed for the global random number generator, which is used by
the g_random_* functions, to seed.
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
Returns the next random gdouble from
rand_ equally distributed over the range [0..1).
Returns the next random gdouble from
rand_ equally distributed over the range
[begin..end).
Frees the memory allocated for the
Rand.
Returns the next random guint32 from
rand_ equally distributed over the range [0..2^32-1].
Returns the next random gint32 from
rand_ equally distributed over the range
[begin..end-1].
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().
Creates a new random number generator initialized with
seed.
Creates a new random number generator initialized with
seed.
Since: 2.4
Sets the seed for the random number generator
Rand to
seed.
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
Performs an atomic bitwise 'and' of the value of
atomic and val, storing the result
back in atomic.
Think of this operation as an atomic version of { tmp = *atomic;
*atomic &= val; return tmp; }.
This call acts as a full compiler and hardware memory barrier.
While atomic has a volatile qualifier, this
is a historical artifact and the pointer passed to it should not be
volatile.
In GLib 2.80, the return type was changed from gsize
to guintptr to add support for platforms with 128-bit
pointers. This should not affect existing code.
Since: 2.30
Get a reproducible random floating point number, see
testRandInt for details on test case random numbers.
Since: 2.16
Get a reproducible random floating pointer number out of a specified
range, see
testRandInt for details on test case random numbers.
Since: 2.16
Get a reproducible random integer number.
The random numbers generated by the g_test_rand_*() family of
functions change with every new test program start, unless the --seed
option is given when starting test programs.
For individual test cases however, the random number generator is
reseeded, to avoid dependencies between tests and to make --seed
effective for all test cases.
Since: 2.16
Get a reproducible random integer number out of a specified range, see
testRandInt for details on test case random numbers.
Since: 2.16
Generates a random UUID (RFC 4122 version 4) as a string. It has the
same randomness guarantees as
Rand, so must not be used for
cryptographic purposes such as key generation, nonces, salts or
one-time pads.
Since: 2.52