00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00019 #ifndef _MCEXTREME_STDC_RAND_H
00020 #define _MCEXTREME_STDC_RAND_H
00021
00022 #include <stdlib.h>
00023
00024 #define __device__ static inline
00025
00026 #define MCX_RNG_NAME "POSIX Multi-threaded RNG"
00027
00028 #define RAND_BUF_LEN 1 //register arrays
00029 #define RAND_SEED_LEN 1
00030
00031 typedef unsigned int uint;
00032
00033 #ifdef _WIN32
00034 #include "drand48_r_libgw32c.h"
00035 #endif
00036
00037 typedef struct drand48_data RandType;
00038
00039
00040 __device__ float rand_uniform01(RandType t[RAND_BUF_LEN]);
00041 __device__ void rng_init(RandType t[RAND_BUF_LEN], RandType tnew[RAND_BUF_LEN],uint *n_seed,int idx);
00042 __device__ void rand_need_more(RandType t[RAND_BUF_LEN],RandType tbuf[RAND_BUF_LEN]);
00043
00044 __device__ float rand_next_scatlen(RandType t[RAND_BUF_LEN]);
00045
00046 __device__ float rand_next_aangle(RandType t[RAND_BUF_LEN]);
00047
00048 __device__ float rand_next_zangle(RandType t[RAND_BUF_LEN]);
00049 __device__ float rand_next_reflect(RandType t[RAND_BUF_LEN]);
00050 __device__ float rand_do_roulette(RandType t[RAND_BUF_LEN]);
00051 #endif