Functions for generating multiple streams of random numbers on the GPU. More...
#include <math.h>Go to the source code of this file.
Functions | |
| __device__ unsigned int | TausStep (unsigned int *seed, int S1, int S2, int S3, unsigned int M) |
| Tausworth random number generator. More... | |
| __device__ unsigned int | LCGStep (unsigned int *seed, unsigned int A, unsigned int C) |
| Simple linear congruential random number generator. More... | |
| __device__ float | hybrid_tausworth_rng (unsigned int *seed1, unsigned int *seed2, unsigned int *seed3, unsigned int *seed4) |
| Hybrid combined Tausworth RNG. More... | |
| __device__ __host__ unsigned int | mult_with_carry_rng (unsigned int *seed1, unsigned int *seed2) |
| Multiply-with-carry RNG (George Marsaglia). More... | |
| void | initialize_rng_seeds (unsigned int *seeds, unsigned int *meta_seed, int n) |
| Generate seeds for n streams. More... | |
| __device__ void | get_seed (unsigned int *seed, unsigned int *rng_state, int i, int n) |
| __device__ void | put_seed (unsigned int *seed, unsigned int *rng_state, int i, int n) |
| __device__ float | random_uniform (unsigned int *seed) |
| __device__ float | random_uniform_positive (unsigned int *seed) |
| template<typename T > | |
| __device__ void | random_normal (T *z1, T *z2, unsigned int *seed) |
| Box-Muller normal RNG. More... | |
Variables | |
| const float | TWOPI = 6.283185307179586 |
Functions for generating multiple streams of random numbers on the GPU.
Definition in file rng.c.
| __device__ void get_seed | ( | unsigned int * | seed, |
| unsigned int * | rng_state, | ||
| int | i, | ||
| int | n | ||
| ) |
| __device__ float hybrid_tausworth_rng | ( | unsigned int * | seed1, |
| unsigned int * | seed2, | ||
| unsigned int * | seed3, | ||
| unsigned int * | seed4 | ||
| ) |
Hybrid combined Tausworth RNG.
| void initialize_rng_seeds | ( | unsigned int * | seeds, |
| unsigned int * | meta_seed, | ||
| int | n | ||
| ) |
Generate seeds for n streams.
Given a meta_seed (input), generate an array of seeds (one per intended rng stream).
| seeds | (out) |
| meta_seed | (in) |
| n | (in) number of seeds to generate |
| __device__ unsigned int LCGStep | ( | unsigned int * | seed, |
| unsigned int | A, | ||
| unsigned int | C | ||
| ) |
Simple linear congruential random number generator.
| __device__ __host__ unsigned int mult_with_carry_rng | ( | unsigned int * | seed1, |
| unsigned int * | seed2 | ||
| ) |
Multiply-with-carry RNG (George Marsaglia).
| __device__ void put_seed | ( | unsigned int * | seed, |
| unsigned int * | rng_state, | ||
| int | i, | ||
| int | n | ||
| ) |
| __device__ void random_normal | ( | T * | z1, |
| T * | z2, | ||
| unsigned int * | seed | ||
| ) |
Box-Muller normal RNG.
| __device__ float random_uniform_positive | ( | unsigned int * | seed) |
| __device__ unsigned int TausStep | ( | unsigned int * | seed, |
| int | S1, | ||
| int | S2, | ||
| int | S3, | ||
| unsigned int | M | ||
| ) |
Tausworth random number generator.
1.8.4