| Top |
Functions
| NcmRNG * | ncm_rng_new () |
| NcmRNG * | ncm_rng_seeded_new () |
| NcmRNG * | ncm_rng_ref () |
| void | ncm_rng_free () |
| void | ncm_rng_clear () |
| void | ncm_rng_lock () |
| void | ncm_rng_unlock () |
| const gchar * | ncm_rng_get_algo () |
| gchar * | ncm_rng_get_state () |
| void | ncm_rng_set_algo () |
| void | ncm_rng_set_state () |
| gboolean | ncm_rng_check_seed () |
| void | ncm_rng_set_seed () |
| gulong | ncm_rng_get_seed () |
| void | ncm_rng_set_random_seed () |
| NcmRNG * | ncm_rng_pool_get () |
Description
This object encapsulates the GSL pseudo random number generator (PRNG). The purpose is to add support for saving and loading state and multhreading.
Functions
ncm_rng_new ()
NcmRNG *
ncm_rng_new (const gchar *algo);
Creates a new NcmRNG using the algorithm algo
see the list of algorithms
here ( http://www.gnu.org/software/gsl/manual/html_node/Random-number-generator-algorithms.html ).
If algo
is NULL the default algorithm and seed are used, see
( http://www.gnu.org/software/gsl/manual/html_node/Random-number-environment-variables.html#Random-number-environment-variables )
for more details.
ncm_rng_seeded_new ()
NcmRNG * ncm_rng_seeded_new (const gchar *algo,gulong seed);
Creates a new NcmRNG using the algorithm algo
see the list of algorithms
here ( http://www.gnu.org/software/gsl/manual/html_node/Random-number-generator-algorithms.html ).
If algo
is NULL the default algorithm is used, see
( http://www.gnu.org/software/gsl/manual/html_node/Random-number-environment-variables.html#Random-number-environment-variables )
for more details.
ncm_rng_clear ()
void
ncm_rng_clear (NcmRNG **rng);
Decreases the reference count of *rng
by one and sets *rng
to NULL.
ncm_rng_get_state ()
gchar *
ncm_rng_get_state (NcmRNG *rng);
Gets the state of the algorithm in Base64. It can be a very large string depending on the underlining
ncm_rng_set_state ()
void ncm_rng_set_state (NcmRNG *rng,const gchar *state);
Sets the algorithm state.
ncm_rng_check_seed ()
gboolean ncm_rng_check_seed (NcmRNG *rng,gulong seed);
Check if the seed was already used by any NcmRNG.
ncm_rng_set_random_seed ()
void ncm_rng_set_random_seed (NcmRNG *rng,gboolean allow_colisions);
Sets the algorithm seed using a PRNG seeded by /dev/urandom (Unix/Linux)
or current time when the first is not available (see ). If
g_rand_new()allow_colisions
is FALSE this function will set the first unused seed
generated.
Property Details
The “algorithm” property
“algorithm” gchar *
Algorithm name.
Flags: Read / Write / Construct
Default value: "mt19937"