Random Number Engine Adaptor Class Templates
/* A
discard_block_engine
adapts an existing base random number engine and produces random values by discarding some of the values returned by its base engine. Each cycle of the compound engine begins by returning r
values successively produced by the base engine and ends by discarding p-r
such values. The engine's state is the state of its base engine followed by the number of calls to operator()
that have occurred since the beginning of the current cycle. */template <typename Engine, size_t p, size_t r> class thrust::random::discard_block_engine;
/* An xor_combine_engine
adapts two existing base random number engines and produces random values by combining the values produced by each. */template <typename Engine1, size_t s1, typename Engine2, size_t s2 = 0u> class thrust::random::xor_combine_engine;
template <typename Engine, size_t p, size_t r> __host__ __device__ bool thrust::random::operator==(const discard_block_engine< Engine, p, r > & lhs, const discard_block_engine< Engine, p, r > & rhs);
template <typename Engine, size_t p, size_t r> __host__ __device__ bool thrust::random::operator!=(const discard_block_engine< Engine, p, r > & lhs, const discard_block_engine< Engine, p, r > & rhs);
template <typename Engine, size_t p, size_t r, typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & thrust::random::operator<<(std::basic_ostream< CharT, Traits > & os, const discard_block_engine< Engine, p, r > & e);
template <typename Engine, size_t p, size_t r, typename CharT, typename Traits> std::basic_istream< CharT, Traits > & thrust::random::operator>>(std::basic_istream< CharT, Traits > & is, discard_block_engine< Engine, p, r > & e);
template <typename Engine1_, size_t s1_, typename Engine2_, size_t s2_> __host__ __device__ bool thrust::random::operator==(const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & lhs, const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & rhs);
template <typename Engine1_, size_t s1_, typename Engine2_, size_t s2_> __host__ __device__ bool thrust::random::operator!=(const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & lhs, const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & rhs);
template <typename Engine1_, size_t s1_, typename Engine2_, size_t s2_, typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & thrust::random::operator<<(std::basic_ostream< CharT, Traits > & os, const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & e);
template <typename Engine1_, size_t s1_, typename Engine2_, size_t s2_, typename CharT, typename Traits> std::basic_istream< CharT, Traits > & thrust::random::operator>>(std::basic_istream< CharT, Traits > & is, xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & e);
Member Classes
Class thrust::random::discard_block_engine
A discard_block_engine
adapts an existing base random number engine and produces random values by discarding some of the values returned by its base engine. Each cycle of the compound engine begins by returning r
values successively produced by the base engine and ends by discarding p-r
such values. The engine’s state is the state of its base engine followed by the number of calls to operator()
that have occurred since the beginning of the current cycle.
Class thrust::random::xor_combine_engine
An xor_combine_engine
adapts two existing base random number engines and produces random values by combining the values produced by each.
Functions
Function thrust::random::operator==
template <typename Engine, size_t p, size_t r> __host__ __device__ bool operator==(const discard_block_engine< Engine, p, r > & lhs, const discard_block_engine< Engine, p, r > & rhs);
This function checks two discard_block_engines
for equality.
Function Parameters:
lhs
The firstdiscard_block_engine
to test.rhs
The seconddiscard_block_engine
to test.
Returns: true
if lhs
is equal to rhs
; false
, otherwise.
Function thrust::random::operator!=
template <typename Engine, size_t p, size_t r> __host__ __device__ bool operator!=(const discard_block_engine< Engine, p, r > & lhs, const discard_block_engine< Engine, p, r > & rhs);
This function checks two discard_block_engines
for inequality.
Function Parameters:
lhs
The firstdiscard_block_engine
to test.rhs
The seconddiscard_block_engine
to test.
Returns: true
if lhs
is not equal to rhs
; false
, otherwise.
Function thrust::random::operator<<
template <typename Engine, size_t p, size_t r, typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > & os, const discard_block_engine< Engine, p, r > & e);
This function streams a discard_block_engine to a std::basic_ostream
.
Function Parameters:
os
Thebasic_ostream
to stream out to.e
Thediscard_block_engine
to stream out.
Returns: os
Function thrust::random::operator>>
template <typename Engine, size_t p, size_t r, typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > & is, discard_block_engine< Engine, p, r > & e);
This function streams a discard_block_engine in from a std::basic_istream.
Function Parameters:
is
Thebasic_istream
to stream from.e
Thediscard_block_engine
to stream in.
Returns: is
Function thrust::random::operator==
template <typename Engine1_, size_t s1_, typename Engine2_, size_t s2_> __host__ __device__ bool operator==(const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & lhs, const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & rhs);
This function checks two xor_combine_engines
for equality.
Function Parameters:
lhs
The firstxor_combine_engine
to test.rhs
The secondxor_combine_engine
to test.
Returns: true
if lhs
is equal to rhs
; false
, otherwise.
Function thrust::random::operator!=
template <typename Engine1_, size_t s1_, typename Engine2_, size_t s2_> __host__ __device__ bool operator!=(const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & lhs, const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & rhs);
This function checks two xor_combine_engines
for inequality.
Function Parameters:
lhs
The firstxor_combine_engine
to test.rhs
The secondxor_combine_engine
to test.
Returns: true
if lhs
is not equal to rhs
; false
, otherwise.
Function thrust::random::operator<<
template <typename Engine1_, size_t s1_, typename Engine2_, size_t s2_, typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > & os, const xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & e);
This function streams a xor_combine_engine to a std::basic_ostream
.
Function Parameters:
os
Thebasic_ostream
to stream out to.e
Thexor_combine_engine
to stream out.
Returns: os
Function thrust::random::operator>>
template <typename Engine1_, size_t s1_, typename Engine2_, size_t s2_, typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > & is, xor_combine_engine< Engine1_, s1_, Engine2_, s2_ > & e);
This function streams a xor_combine_engine in from a std::basic_istream.
Function Parameters:
is
Thebasic_istream
to stream from.e
Thexor_combine_engine
to stream in.
Returns: is