Class thrust::random::linear_feedback_shift_engine
A linear_feedback_shift_engine
random number engine produces unsigned integer random values using a linear feedback shift random number generation algorithm.
Note: linear_feedback_shift_engine is based on the Boost Template Library’s linear_feedback_shift.
Template Parameters:
UIntType
The type of unsigned integer to produce.w
The word size of the produced values (w <= sizeof(UIntType)
).k
The k parameter of Tausworthe’s 1965 algorithm.q
The q exponent of Tausworthe’s 1965 algorithm.s
The step size of Tausworthe’s 1965 algorithm.
#include <thrust/random/linear_feedback_shift_engine.h>
template <typename UIntType, size_t w, size_t k, size_t q, size_t s> class thrust::random::linear_feedback_shift_engine { public:
/* The type of the unsigned integer produced by this linear_feedback_shift_engine
. */ typedef see below result_type;
static const size_t word_size = see below;
static const size_t exponent1 = see below;
static const size_t exponent2 = see below;
static const size_t step_size = see below;
static const result_type min = see below;
static const result_type max = see below;
static const result_type default_seed = see below;
explicit _CCCL_HOST_DEVICE linear_feedback_shift_engine(result_type value = default_seed) = default;
_CCCL_HOST_DEVICE void seed(result_type value = default_seed) = default;
_CCCL_HOST_DEVICE result_type operator()(void);
_CCCL_HOST_DEVICE void discard(unsigned long long z); };
Member Types
Typedef thrust::random::linear_feedback_shift_engine::result_type
typedef UIntTyperesult_type;
The type of the unsigned integer produced by this linear_feedback_shift_engine
.
Member Variables
Variable thrust::random::linear_feedback_shift_engine::word_size
static const size_t word_size = w;
The word size of the produced values.
Variable thrust::random::linear_feedback_shift_engine::exponent1
static const size_t exponent1 = k;
A constant used in the generation algorithm.
Variable thrust::random::linear_feedback_shift_engine::exponent2
static const size_t exponent2 = q;
A constant used in the generation algorithm.
Variable thrust::random::linear_feedback_shift_engine::step_size
static const size_t step_size = s;
The step size used in the generation algorithm.
Variable thrust::random::linear_feedback_shift_engine::min
static const result_type min = 0;
The smallest value this linear_feedback_shift_engine
may potentially produce.
Variable thrust::random::linear_feedback_shift_engine::max
static const result_type max = wordmask;
The largest value this linear_feedback_shift_engine
may potentially produce.
Variable thrust::random::linear_feedback_shift_engine::default_seed
static const result_type default_seed = 341u;
The default seed of this linear_feedback_shift_engine
.
Member Functions
Function thrust::random::linear_feedback_shift_engine::linear_feedback_shift_engine
explicit _CCCL_HOST_DEVICE linear_feedback_shift_engine(result_type value = default_seed) = default;
This constructor, which optionally accepts a seed, initializes a new linear_feedback_shift_engine
.
Function Parameters: value
: The seed used to intialize this linear_feedback_shift_engine's
state.
Function thrust::random::linear_feedback_shift_engine::seed
_CCCL_HOST_DEVICE void seed(result_type value = default_seed) = default;
This method initializes this linear_feedback_shift_engine's
state, and optionally accepts a seed value.
Function Parameters: value
: The seed used to initializes this linear_feedback_shift_engine's
state.
Function thrust::random::linear_feedback_shift_engine::operator()
_CCCL_HOST_DEVICE result_type operator()(void);
This member function produces a new random value and updates this linear_feedback_shift_engine's
state.
Returns: A new random number.
Function thrust::random::linear_feedback_shift_engine::discard
_CCCL_HOST_DEVICE void discard(unsigned long long z);
This member function advances this linear_feedback_shift_engine's
state a given number of times and discards the results.
Note: This function is provided because an implementation may be able to accelerate it.
Function Parameters: z
: The number of random values to discard.