Node:Functions, Next:, Previous:Description, Up:Usage



PRNG Functions

struct prng prng_new (char *str) Library Function
Create a new generator object. If initialisation of the generator object fails then NULL is returned. Thus the pointer returned by this routine must be checked against NULL before using it. Otherwise the program aborts with a segmentation fault.

void prng_reset (struct prng *g) Library Function
Reset random number generator.

double prng_get_next (struct prng *g) Library Function
Sample from generator (get next pseudo-random number from stream).

void prng_get_array (struct prng *g, double *array, int count) Library Function
Sample array of length count.

prng_num prng_get_next_int (struct prng *g) Library Function
Sample integer random number from generator.

void prng_free (struct prng *g) Library Function
Destroy generator object.

char* prng_short_name (struct prng *g) Library Function
Get name of generator as in call to prng_new.

char* prng_long_name (struct prng *g) Library Function
Get name of generator with shortcuts expanded.

int prng_is_congruential (struct prng *g) Library Function
TRUE if g is a congruential generator.

prng_num prng_get_modulus (struct prng *g) Library Function
Return modulus of generator.

int prng_can_seed (struct prng *g) Library Function
TRUE if generator g can be reseeded.

void prng_seed (struct prng *g, prng_num next) Library Function
Reseed generator.

int prng_can_fast_sub (struct prng *g) Library Function
TRUE if subsequences of the random stream can computed directly.

char* prng_get_sub_def (struct prng *g, int s, int i) Library Function
Get definition for the generator of the subsequence stream of g with starting point i and stepwidth s. It returns a character string that can be used a argument for prng_new. For generators where prng_can_fast_sub is TRUE. (see also SUB).

int prng_can_fast_con (struct prng *g) Library Function
TRUE if blocks of the random stream can computed directly.

int prng_get_con_def (struct prng *g, int l, int i) Library Function
Get definition for the generator of the blocked stream of g with position i and block length l. It returns a character string that can be used a argument for prng_new. For generators where prng_can_fast_con is TRUE. (see also CON).