npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::CPP11RandomGen< RandomEngine > Class Template Reference

#include <CPP11RandomGen.hh>

Inheritance diagram for npstat::CPP11RandomGen< RandomEngine >:
npstat::AbsRandomGenerator

Public Member Functions

 CPP11RandomGen (RandomEngine &fcn)
 
unsigned dim () const
 
double operator() ()
 
- Public Member Functions inherited from npstat::AbsRandomGenerator
virtual unsigned long long maxPoints () const
 
virtual void run (double *buf, const unsigned bufLen, const unsigned nPt)
 

Detailed Description

template<typename RandomEngine>
class npstat::CPP11RandomGen< RandomEngine >

Wrapper class for random number generators defined in the C++11 standard. This class will not make a copy of the original generator, only a reference to it is stored. You will not be able to use this class in a meaningful way unless you have a C++11-compliant compiler which provides the <random> header.

The template type should be one of the random engines defined by C++11. Example:

std::random_device rd; std::mt19937 eng(rd()); npstat::CPP11RandomGen<decltype(eng)> gen(eng);

Now, gen() will produce pseudo-random numbers.

Member Function Documentation

◆ dim()

template<typename RandomEngine >
unsigned npstat::CPP11RandomGen< RandomEngine >::dim ( ) const
inlinevirtual

Dimensionality of the generated vectors (or points). It is expected that "dim()" will always be 1 for pseudo-random (as opposed to quasi-random) generators.

Implements npstat::AbsRandomGenerator.

◆ operator()()

template<typename RandomEngine >
double npstat::CPP11RandomGen< RandomEngine >::operator() ( )
inlinevirtual

Standard 1-d generator function. It should generate a run-time error for essentially multivariate generators whose dimensionality is larger than 1.

Implements npstat::AbsRandomGenerator.


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