mmc_rand_logistic.h
Go to the documentation of this file.
1 /***************************************************************************/
32 /***************************************************************************/
38 #ifndef _MCEXTREME_LOGISTIC_RAND_H
39 #define _MCEXTREME_LOGISTIC_RAND_H
40 
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <math.h>
44 
45 #define __device__ static inline
46 
47 #ifndef DOUBLE_PREC_LOGISTIC
48  typedef float RandType;
49 #else
50  typedef double RandType;
51 #endif
52 
53 #define MCX_RNG_NAME "Logistic-Lattice"
54 
55 #define RAND_BUF_LEN 5 //register arrays
56 #define RAND_SEED_WORD_LEN 5 //32bit seed length (32*5=160bits)
57 
58 __device__ void rand_need_more(RandType t[RAND_BUF_LEN], RandType tbuf[RAND_BUF_LEN]);
59 __device__ void logistic_init(RandType* t, RandType* tnew, uint seed[], uint idx);
60 
61 __device__ RandType rand_uniform01(RandType v);
62 __device__ void rng_init(RandType t[RAND_BUF_LEN], RandType tnew[RAND_BUF_LEN], uint* n_seed, int idx);
63 
64 // generate [0,1] random number for the next scattering length
65 __device__ float rand_next_scatlen(RandType t[RAND_BUF_LEN]);
66 // generate [0,1] random number for the next arimuthal angle
67 __device__ float rand_next_aangle(RandType t[RAND_BUF_LEN]);
68 // generate random number for the next zenith angle
69 __device__ float rand_next_zangle(RandType t[RAND_BUF_LEN]);
70 __device__ float rand_next_reflect(RandType t[RAND_BUF_LEN]);
71 __device__ float rand_do_roulette(RandType t[RAND_BUF_LEN]);
72 
73 #ifdef MMC_USE_SSE_MATH
74  __device__ void rand_next_aangle_sincos(RandType t[RAND_BUF_LEN], float* si, float* co);
75  __device__ float rand_next_scatlen_ps(RandType t[RAND_BUF_LEN]);
76 #endif
77 
78 #endif
__device__ float rand_do_roulette(RandType t[RAND_BUF_LEN])
generate random number for the next zenith angle
Definition: mmc_rand_common.h:62
__device__ float rand_next_aangle(RandType t[RAND_BUF_LEN])
generate [0,1] random number for the next arimuthal angle
Definition: mmc_rand_common.h:50
__device__ float rand_next_scatlen(RandType t[RAND_BUF_LEN])
generate [0,1] random number for the next scattering length
Definition: mmc_rand_common.h:46
__device__ float rand_next_reflect(RandType t[RAND_BUF_LEN])
generate random number for reflection test
Definition: mmc_rand_common.h:58
__device__ float rand_next_zangle(RandType t[RAND_BUF_LEN])
generate random number for the next zenith angle
Definition: mmc_rand_common.h:54