summaryrefslogtreecommitdiff
path: root/src/common/WELL1024a.h
blob: 04bf1a1085e05dc9d2c643ac12d36b62062b31a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* ***************************************************************************** */
/* Copyright:      Francois Panneton and Pierre L'Ecuyer, University of Montreal */
/*                 Makoto Matsumoto, Hiroshima University                        */
/* Notice:         This code can be used freely for personal, academic,          */
/*                 or non-commercial purposes. For commercial purposes,          */
/*                 please contact P. L'Ecuyer at: lecuyer@iro.UMontreal.ca       */
/* ***************************************************************************** */

#define WELL1024_WIDTH 32 /* 128 bytes */

typedef struct {
	unsigned i;
	unsigned state[WELL1024_WIDTH];
} rngstate_t;

rngstate_t* InitWELLRNG1024a (unsigned *init);
double WELLRNG1024a (rngstate_t* s);

/*!
 * \brief Get pseudorandom number from PRNG initialized in thread-local storage.
 *
 * No need for initialization, TLS will take care of it.
 *
 * \retval Pseudorandom number.
 */
double tls_rand();

/*!
 * \brief Set PRNG seed in thread-local storage to requested value.
 *
 */
void tls_seed_set(unsigned init[WELL1024_WIDTH]);