|
libsc 2.8.5.210-64a7
The SC library provides support for parallel scientific applications.
|
Provide pseudo-random generator and Poisson sampling. More...
#include <sc.h>
Go to the source code of this file.
Typedefs | |
| typedef uint64_t | sc_rand_state_t |
| The internal state of sc_rand and derived functions. More... | |
Functions | |
| double | sc_rand (sc_rand_state_t *state) |
| Draw a (pseudo-)random variable uniformly distributed in [0, 1). More... | |
| double | sc_rand_normal (sc_rand_state_t *state, double *second_result) |
| Sample the Gauss standard normal distribution. More... | |
| int | sc_rand_small (sc_rand_state_t *state, double d) |
| Randomly draw either 0 or 1 where the probability for 1 is small. More... | |
| int | sc_rand_poisson (sc_rand_state_t *state, double mean) |
| Draw from a random variable following the Poisson distribution. More... | |
Provide pseudo-random generator and Poisson sampling.
| typedef uint64_t sc_rand_state_t |
The internal state of sc_rand and derived functions.
Can be set arbitrarily to obtain reproducible pseudo random numbers.
| double sc_rand | ( | sc_rand_state_t * | state | ) |
Draw a (pseudo-)random variable uniformly distributed in [0, 1).
| [in,out] | state | Internal state of random number generator. |
| double sc_rand_normal | ( | sc_rand_state_t * | state, |
| double * | second_result | ||
| ) |
Sample the Gauss standard normal distribution.
Implements polar form of the Box Muller transform based on sc_rand.
| [in,out] | state | Internal state of random number generator. |
| [in,out] | second_result | We compute two independent samples. The first is the return value. The second is placed in *second_result unless second_result == NULL. |
| int sc_rand_poisson | ( | sc_rand_state_t * | state, |
| double | mean | ||
| ) |
Draw from a random variable following the Poisson distribution.
| [in,out] | state | Internal state of random number generator. |
| [in] | mean | Mean value of Poisson distribution. |
| int sc_rand_small | ( | sc_rand_state_t * | state, |
| double | d | ||
| ) |
Randomly draw either 0 or 1 where the probability for 1 is small.
| [in,out] | state | Internal state of random number generator. |
| [in] | d | Probability of drawing ones. |