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