thrust::random::linear_feedback_shift_engine

Defined in thrust/random/linear_feedback_shift_engine.h

template<typename UIntType, size_t w, size_t k, size_t q, size_t s>
class 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.

Public Types

typedef UIntType result_type

The type of the unsigned integer produced by this linear_feedback_shift_engine.

Public Functions

explicit linear_feedback_shift_engine(result_type value = default_seed)

This constructor, which optionally accepts a seed, initializes a new linear_feedback_shift_engine.

Parameters

value – The seed used to intialize this linear_feedback_shift_engine's state.

void seed(result_type value = default_seed)

This method initializes this linear_feedback_shift_engine's state, and optionally accepts a seed value.

Parameters

value – The seed used to initializes this linear_feedback_shift_engine's state.

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.

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.

Parameters

z – The number of random values to discard.

Public Static Attributes

static const size_t word_size = w

The word size of the produced values.

static const size_t exponent1 = k

A constant used in the generation algorithm.

static const size_t exponent2 = q

A constant used in the generation algorithm.

static const size_t step_size = s

The step size used in the generation algorithm.

static const result_type min = 0

The smallest value this linear_feedback_shift_engine may potentially produce.

static const result_type max = wordmask

The largest value this linear_feedback_shift_engine may potentially produce.

static const result_type default_seed = 341u

The default seed of this linear_feedback_shift_engine.