21 #ifndef ROCRAND_SCRAMBLED_SOBOL64_H_
22 #define ROCRAND_SCRAMBLED_SOBOL64_H_
25 #define FQUALIFIERS __forceinline__ __device__
28 #include "rocrand/rocrand_common.h"
29 #include "rocrand/rocrand_sobol64.h"
31 namespace rocrand_device
34 template<
bool UseSharedVectors>
35 class scrambled_sobol64_engine
39 scrambled_sobol64_engine() : scramble_constant() {}
42 scrambled_sobol64_engine(
const unsigned long long int* vectors,
43 const unsigned long long int scramble_constant,
44 const unsigned int offset)
45 : m_engine(vectors, 0), scramble_constant(scramble_constant)
52 void discard(
unsigned long long int offset)
54 m_engine.discard(offset);
65 void discard_stride(
unsigned long long int stride)
67 m_engine.discard_stride(stride);
71 unsigned long long int operator()()
77 unsigned long long int next()
79 unsigned long long int p = m_engine.next();
80 return p ^ scramble_constant;
84 unsigned long long int current()
86 unsigned long long int p = m_engine.current();
87 return p ^ scramble_constant;
92 sobol64_engine<UseSharedVectors> m_engine;
94 unsigned long long int scramble_constant;
106 typedef rocrand_device::scrambled_sobol64_engine<false> rocrand_state_scrambled_sobol64;
122 const unsigned long long int scramble_constant,
123 const unsigned int offset,
124 rocrand_state_scrambled_sobol64* state)
126 *state = rocrand_state_scrambled_sobol64(vectors, scramble_constant, offset);
142 unsigned long long int rocrand(rocrand_state_scrambled_sobol64* state)
144 return state->next();
156 void skipahead(
unsigned long long offset, rocrand_state_scrambled_sobol64* state)
158 return state->discard(offset);
FQUALIFIERS void skipahead(unsigned long long offset, rocrand_state_scrambled_sobol64 *state)
Updates scrambled_sobol64 state to skip ahead by offset elements.
Definition: rocrand_scrambled_sobol64.h:156
FQUALIFIERS unsigned long long int rocrand(rocrand_state_scrambled_sobol64 *state)
Returns uniformly distributed random unsigned int value from [0; 2^64 - 1] range.
Definition: rocrand_scrambled_sobol64.h:142
FQUALIFIERS void rocrand_init(const unsigned long long int *vectors, const unsigned long long int scramble_constant, const unsigned int offset, rocrand_state_scrambled_sobol64 *state)
Initialize scrambled_sobol64 state.
Definition: rocrand_scrambled_sobol64.h:121
#define FQUALIFIERS
Shorthand for commonly used function qualifiers.
Definition: rocrand_uniform.h:31