AnimatLab  2
RNG_rand48 Class Reference

#include <gpu_random.h>

+ Collaboration diagram for RNG_rand48:

Public Member Functions

 RNG_rand48 (int seed, int _max=0)
 initialize the RNG with seed, just as the standard srand48-function
void generate (int n)
void generate (int n, int n_max)
void get (int *r, int n)
void * get_random_numbers ()

Static Public Attributes

static const unsigned int MAX_RANGE =0x7FFFFFFF

Detailed Description

a rand48 random number generator. The random number generator works similar to the standard lrand48. The seed, which is normally set by srand48, here a parameter of the constructor. Random numbers are drawn in two steps:

  • first, random numbers are generated via the generate function, and then
  • then, they can be retrieved via the get function Alternatively, you can use them directly on the GPU. A pointer to the random number array can be retrieved by get_random_numbers. This functions returns a void *, to avoid CUDA data types in this header file. The true type is however int *.

Definition at line 42 of file gpu_random.h.

Member Function Documentation

void RNG_rand48::generate ( int  n)

generate n random numbers as 31-bit integers like lrand48

void RNG_rand48::generate ( int  n,
int  n_max 

generate n random numbers as 31-bit integers like lrand48 with user specified max value

void RNG_rand48::get ( int *  r,
int  n 

get the first n of the previously generated numbers into array r. r must be large enough to contain all the numbers, and enough numbers have to be generated before.

void* RNG_rand48::get_random_numbers ( )

return a GPU pointer to the generated random numbers, for using them in other GPU functions.

Definition at line 91 of file gpu_random.h.

The documentation for this class was generated from the following file: