My Project
programmer's documentation
Functions
cs_random.h File Reference
#include <mpi.h>
#include "cs_defs.h"
Include dependency graph for cs_random.h:

Go to the source code of this file.

Functions

void cs_random_seed (int seed)
 Initialize random number generator. More...
 
void cs_random_uniform (cs_lnum_t n, cs_real_t a[])
 Uniform distribution random number generator. More...
 
void cs_random_normal (cs_lnum_t n, cs_real_t x[])
 Normal distribution random number generator. More...
 
void cs_random_poisson (cs_lnum_t n, cs_real_t mu, int p[])
 Poisson distribution random number generator. More...
 
void cs_random_save (cs_real_t save_block[1634])
 Save static variables used by random number generator. More...
 
void cs_random_restore (cs_real_t save_block[1634])
 Restore static variables used by random number generator. More...
 

Function Documentation

◆ cs_random_normal()

void cs_random_normal ( cs_lnum_t  n,
cs_real_t  x[] 
)

Normal distribution random number generator.

Box-Muller method for Gaussian random numbers.

Parameters
[in]nnumber of values to compute
[out]xpseudo-random numbers following normal distribution

◆ cs_random_poisson()

void cs_random_poisson ( cs_lnum_t  n,
cs_real_t  mu,
int  p[] 
)

Poisson distribution random number generator.

q(mu,p) = exp(-mu) mu**p/p!

Parameters
[in]nnumber of values to compute
[in]muPoisson distribution parameter
[out]ppseudo-random numbers following Poisson distribution

◆ cs_random_restore()

void cs_random_restore ( cs_real_t  save_block[1634])

Restore static variables used by random number generator.

Parameters
[out]save_blocksaved state values

◆ cs_random_save()

void cs_random_save ( cs_real_t  save_block[1634])

Save static variables used by random number generator.

Parameters
[out]save_blocksaved state values

◆ cs_random_seed()

void cs_random_seed ( int  seed)

Initialize random number generator.

Generates initial seed buffer by linear congruential method. Taken from Marsaglia, FSU report FSU-SCRI-87-50.

Parameters
[in]seedvariable seed, with 0 < seed < 31328

◆ cs_random_uniform()

void cs_random_uniform ( cs_lnum_t  n,
cs_real_t  a[] 
)

Uniform distribution random number generator.

Portable lagged Fibonacci series uniform random number generator with "lags" -273 und -607: W.P. Petersen, IPS, ETH Zuerich, 19 Mar. 92

Parameters
[in]nnumber of values to compute
[out]apseudo-random numbers following uniform distribution