| INGOR
    | 
Structure for encapsulating the random number generator. More...
#include <ytRNG.h>
| Public Member Functions | |
| ytRNG * | ytRNG_new () | 
| Generates an ytRNG instance. | |
| void | ytRNG_delete (ytRNG *rng) | 
| Releases the resources allocated for the ytRNG instance. | |
| void | ytRNG_setSeed (ytRNG *rng, int seed) | 
| Initializes the random number generator. | |
| void | ytRNG_normal (ytRNG *rng, double *ar, int n, double mean, double sigma) | 
| Generates the normally distributed random numbers. | |
| void | ytRNG_uniform (ytRNG *rng, double *ar, int n, double min, double max) | 
| Generates the normally distributed random numbers. | |
| void | ytRNG_integer (ytRNG *rng, int *ar, int n, int min, int max) | 
| Generates integer random numbers. | |
| void | ytRNG_perm (ytRNG *rng, int *ar, int n) | 
| Generates an integer random permuation vector. | |
| void | ytRNG_shuffle (ytRNG *rng, int *ar, int n) | 
| Shuffles the elements of the integer array. | |
| Public Attributes | |
| ytRNG_dSFMT * | dsfmt | 
| double | work [DSFMT_N64] | 
Structure for encapsulating the random number generator.
Depending on the environment, this uses the appropriate implementation / library to generate random numbers. The following is the list of supported environment (C macro) and its math library.
| void ytRNG_delete | ( | ytRNG * | rng | ) | 
| void ytRNG_integer | ( | ytRNG * | rng, | 
| int * | ar, | ||
| int | n, | ||
| int | min, | ||
| int | max ) | 
Generates integer random numbers.
This generates integer random numbers ranging [min,max).
| rng | Intitialized ytRNG instance. | 
| ar | Array in which the generated random numbers are stored. | 
| n | Numbers of random number to generate. | 
| min | Lower bound of the random values (inclusive). | 
| max | Upper bound of the random values (exclusive). | 
| ytRNG * ytRNG_new | ( | ) | 
Generates an ytRNG instance.
Call ytRNG_set_seed() to initialize the random number generator.
Call ytRNG_delete() to release the resources allocated by this routine.
| void ytRNG_normal | ( | ytRNG * | rng, | 
| double * | ar, | ||
| int | n, | ||
| double | mean, | ||
| double | sigma ) | 
Generates the normally distributed random numbers.
The appropriate algorithm is selected based on the environment.
| rng | Initialized ytRNG instance. | 
| ar | Array in which the generated random numbers are stored. | 
| n | Number of random numbers to generate. | 
| mean | Mean of the normal distribution. | 
| sigma | Standard deviation of the normal distribution. | 
| void ytRNG_perm | ( | ytRNG * | rng, | 
| int * | ar, | ||
| int | n ) | 
Generates an integer random permuation vector.
This generates an random permutation ranging from 0 to n − 1.
| [in] | rng | Initialized ytRNG instance. | 
| [out] | ar | Array in which the generated random permuation vector is stored. | 
| [int] | n Length of the permutation vector. | 
| void ytRNG_setSeed | ( | ytRNG * | rng, | 
| int | seed ) | 
Initializes the random number generator.
The appropriate algorithm is selected based on the environment.
In Fujitsu SSL II library, 0 cannot be specified as the seed. Thus, if 0 is specified, it is regarded as 1.
| rng | ytRNG instance to be initialized. | 
| seed | Seed of the random number generator. | 
| void ytRNG_shuffle | ( | ytRNG * | rng, | 
| int * | ar, | ||
| int | n ) | 
Shuffles the elements of the integer array.
This shuffles the order of elements in the given integer array.
| [in] | rng | Initialized ytRNG instance. | 
| [in,out] | ar | Array in which the order of the elements are shuffled. | 
| [in] | n | Length of the array. | 
| void ytRNG_uniform | ( | ytRNG * | rng, | 
| double * | ar, | ||
| int | n, | ||
| double | min, | ||
| double | max ) | 
Generates the normally distributed random numbers.
The appropriate algorithm is selected based on the environment.
| rng | Initialized ytRNG instance. | 
| ar | Array in which the generated random numbers are stored. | 
| n | Number of random numbers to generate. | 
| min | Lower bound of the uniform distribution. | 
| max | Upper bound of the uniform distribution. |