thrust
Public Types | Public Member Functions | Static Public Attributes | List of all members
thrust::random::xor_combine_engine< Engine1, s1, Engine2, s2 > Class Template Reference

An xor_combine_engine adapts two existing base random number engines and produces random values by combining the values produced by each. More...

#include <thrust/random/xor_combine_engine.h>

Public Types

typedef Engine1 base1_type
 The type of the first adapted base random number engine.
 
typedef Engine2 base2_type
 The type of the second adapted base random number engine.
 
typedef thrust::detail::eval_if<(sizeof(typename base2_type::result_type) > sizeof(typename base1_type::result_type)), thrust::detail::identity_< typename base2_type::result_type >, thrust::detail::identity_< typename base1_type::result_type > >::type result_type
 The type of the unsigned integer produced by this xor_combine_engine.
 

Public Member Functions

__host__ __device__ xor_combine_engine (void)
 
__host__ __device__ xor_combine_engine (const base1_type &urng1, const base2_type &urng2)
 
__host__ __device__ xor_combine_engine (result_type s)
 
__host__ __device__ void seed (void)
 
__host__ __device__ void seed (result_type s)
 
__host__ __device__ result_type operator() (void)
 
__host__ __device__ void discard (unsigned long long z)
 
__host__ __device__ const base1_typebase1 (void) const
 
__host__ __device__ const base2_typebase2 (void) const
 

Static Public Attributes

static const size_t shift1 = s1
 
static const size_t shift2 = s2
 
static const result_type min = 0
 
static const result_type max
 

Detailed Description

template<typename Engine1, size_t s1, typename Engine2, size_t s2 = 0u>
class thrust::random::xor_combine_engine< Engine1, s1, Engine2, s2 >

An xor_combine_engine adapts two existing base random number engines and produces random values by combining the values produced by each.

Template Parameters
Engine1The type of the first base random number engine to adapt.
s1The size of the first shift to use in the generation algorithm.
Engine2The type of the second base random number engine to adapt.
s2The second of the second shift to use in the generation algorithm. Defaults to 0.

The following code snippet shows an example of using an xor_combine_engine instance:

#include <iostream>
int main(void)
{
// create an xor_combine_engine from minstd_rand and minstd_rand0
// use a shift of 0 for each
// print a random number to standard output
std::cout << rng() << std::endl;
return 0;
}

The documentation for this class was generated from the following file: