thrust::random::xor_combine_engine#
- 
template<typename Engine1, size_t s1, typename Engine2, size_t s2 = 0u>
class xor_combine_engine# An
xor_combine_engineadapts two existing base random number engines and produces random values by combining the values produced by each.The following code snippet shows an example of using an
xor_combine_engineinstance:#include <thrust/random/linear_congruential_engine.h> #include <thrust/random/xor_combine_engine.h> #include <iostream> int main() { // create an xor_combine_engine from minstd_rand and minstd_rand0 // use a shift of 0 for each thrust::xor_combine_engine<thrust::minstd_rand,0,thrust::minstd_rand0,0> rng; // print a random number to standard output std::cout << rng() << std::endl; return 0; }
- Template Parameters:
 Engine1 – The type of the first base random number engine to adapt.
s1 – The size of the first shift to use in the generation algorithm.
Engine2 – The type of the second base random number engine to adapt.
s2 – The second of the second shift to use in the generation algorithm. Defaults to
0.
Public Types
- 
typedef typename thrust::detail::eval_if<(sizeof(typename base2_type::result_type) > sizeof(typename base1_type::result_type)), ::cuda::std::type_identity<typename base2_type::result_type>, ::cuda::std::type_identity<typename base1_type::result_type>>::type result_type#
 The type of the unsigned integer produced by this
xor_combine_engine.
Public Functions
- 
xor_combine_engine()#
 This constructor constructs a new
xor_combine_engineand constructs its adapted engines using their null constructors.
- 
xor_combine_engine(const base1_type &urng1, const base2_type &urng2)#
 This constructor constructs a new
xor_combine_engineusing givenbase1_typeandbase2_typeengines to initialize its adapted base engines.- Parameters:
 urng1 – A
base1_typeto use to initialize thisxor_combine_engine'sfirst adapted base engine.urng2 – A
base2_typeto use to initialize thisxor_combine_engine'sfirst adapted base engine.
- 
xor_combine_engine(result_type s)#
 This constructor initializes a new
xor_combine_enginewith a given seed.- Parameters:
 s – The seed used to initialize this
xor_combine_engine'sadapted base engines.
- 
void seed()#
 This method initializes the state of this
xor_combine_engine'sadapted base engines by using theirdefault_seedvalues.
- 
void seed(result_type s)#
 This method initializes the state of this
xor_combine_engine'sadapted base engines by using the given seed.- Parameters:
 s – The seed with which to initialize this
xor_combine_engine'sadapted base engines.
- 
result_type operator()(void)#
 This member function produces a new random value and updates this
xor_combine_engine'sstate.- Returns:
 A new random number.
- 
void discard(unsigned long long z)#
 This member function advances this
xor_combine_engine'sstate 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.
- 
const base1_type &base1() const#
 This member function returns a const reference to this
xor_combine_engine'sfirst adapted base engine.- Returns:
 A const reference to the first base engine this
xor_combine_engineadapts.
- 
const base2_type &base2() const#
 This member function returns a const reference to this
xor_combine_engine'ssecond adapted base engine.- Returns:
 A const reference to the second base engine this
xor_combine_engineadapts.
Public Static Attributes
- 
static const result_type min = 0#
 The smallest value this
xor_combine_enginemay potentially produce.
- 
static const result_type max = detail::xor_combine_engine_max<Engine1, s1, Engine2, s2, result_type>::value#
 The largest value this
xor_combine_enginemay potentially produce.