00001
00008
00014 #ifndef _MCEXTREME_SFMT_RAND_H
00015 #define _MCEXTREME_SFMT_RAND_H
00016
00017 #include <stdio.h>
00018 #include <stdlib.h>
00019 #include <math.h>
00020
00021 #define __device__ static inline
00022
00023 typedef unsigned int RandType;
00024 typedef unsigned int uint;
00025
00026 #define MCX_RNG_NAME "SFMT19937 RNG"
00027
00028 #define RAND_BUF_LEN 624 //buffer length
00029 #define RAND_SEED_LEN 2 //
00030 #define MEXP 19937
00031
00032 __device__ void rng_init(RandType t[RAND_BUF_LEN], RandType tnew[RAND_BUF_LEN],uint *n_seed,int idx);
00033
00034 __device__ void rand_need_more(RandType t[RAND_BUF_LEN],RandType tbuf[RAND_BUF_LEN]);
00035
00036 __device__ float rand_next_scatlen(RandType t[RAND_BUF_LEN]);
00037
00038 __device__ float rand_next_aangle(RandType t[RAND_BUF_LEN]);
00039
00040 __device__ float rand_next_zangle(RandType t[RAND_BUF_LEN]);
00041 __device__ float rand_next_reflect(RandType t[RAND_BUF_LEN]);
00042 __device__ float rand_do_roulette(RandType t[RAND_BUF_LEN]);
00043 #endif