53 #ifndef ROCRAND_THREEFRY4X32_20_H_
54 #define ROCRAND_THREEFRY4X32_20_H_
56 #include "rocrand/rocrand_threefry4_impl.h"
58 namespace rocrand_device
61 class threefry4x32_20_engine :
public threefry_engine4_base<uint4, unsigned int, 20>
64 ROCRAND_DEPRECATED(
"Alias \"threefry4x32_20_state\" is deprecated. Use \"state_type\" instead.")
65 typedef threefry_engine4_base<uint4,
unsigned int, 20>::threefry_state_4 threefry4x32_20_state;
72 __forceinline__ __device__ __host__ threefry4x32_20_engine(const
unsigned long long seed = 0,
73 const
unsigned long long subsequence
75 const
unsigned long long offset = 0)
77 this->seed(seed, subsequence, offset);
85 __forceinline__ __device__ __host__
void seed(
const unsigned long long seed = 0,
86 const unsigned long long subsequence = 0,
87 const unsigned long long offset = 0)
89 m_state.counter = {0U, 0U, 0U, 0U};
90 m_state.result = {0U, 0U, 0U, 0U};
93 m_state.key = {
static_cast<unsigned int>(seed),
94 static_cast<unsigned int>(seed >> 16),
95 static_cast<unsigned int>(seed >> 32),
96 static_cast<unsigned int>(seed >> 48)};
98 this->discard_subsequence_impl(subsequence);
99 this->discard(offset);
100 m_state.result = this->threefry_rounds(m_state.counter, m_state.key);
106 typedef rocrand_device::threefry4x32_20_engine rocrand_state_threefry4x32_20;
119 __forceinline__ __device__ __host__
void rocrand_init(
const unsigned long long seed,
120 const unsigned long long subsequence,
121 const unsigned long long offset,
122 rocrand_state_threefry4x32_20* state)
124 *state = rocrand_state_threefry4x32_20(seed, subsequence, offset);
141 __forceinline__ __device__ __host__
unsigned int rocrand(rocrand_state_threefry4x32_20* state)
143 return state->next();
158 __forceinline__ __device__ __host__ uint4
rocrand4(rocrand_state_threefry4x32_20* state)
160 return state->next4();
__forceinline__ __device__ __host__ void rocrand_init(const uint4 seed, const unsigned int subsequence, rocrand_state_lfsr113 *state)
Initializes LFSR113 state.
Definition: rocrand_lfsr113.h:238
__forceinline__ __device__ __host__ uint4 rocrand4(rocrand_state_philox4x32_10 *state)
Returns four uniformly distributed random unsigned int values from [0; 2^32 - 1] range.
Definition: rocrand_philox4x32_10.h:386
__forceinline__ __device__ __host__ unsigned int rocrand(rocrand_state_lfsr113 *state)
Returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range.
Definition: rocrand_lfsr113.h:274