prrng 1.12.1
Loading...
Searching...
No Matches
prrng::GeneratorBase< Derived > Class Template Reference

Base class of the pseudorandom number generators providing common methods. More...

#include <prrng.h>

Public Member Functions

double cumsum_random (size_t n)
 Result of the cumulative sum of n random numbers.
 
double cumsum_delta (size_t n, double scale=1)
 Result of the cumulative sum of n 'random' numbers, distributed according to a delta distribution,.
 
double cumsum_exponential (size_t n, double scale=1)
 Result of the cumulative sum of n random numbers, distributed according to an exponential distribution, see exponential_distribution(),.
 
double cumsum_power (size_t n, double k=1)
 Result of the cumulative sum of n random numbers, distributed according to a power distribution, see power_distribution(),.
 
double cumsum_gamma (size_t n, double k=1, double scale=1)
 Result of the cumulative sum of n random numbers, distributed according to a gamma distribution, see gamma_distribution(),.
 
double cumsum_pareto (size_t n, double k=1, double scale=1)
 Result of the cumulative sum of n random numbers, distributed according to a Pareto distribution, see pareto_distribution(),.
 
double cumsum_weibull (size_t n, double k=1, double scale=1)
 Result of the cumulative sum of n random numbers, distributed according to a weibull distribution, see weibull_distribution(),.
 
double cumsum_normal (size_t n, double mu=0, double sigma=1)
 Result of the cumulative sum of n random numbers, distributed according to a normal distribution, see normal_distribution(),.
 
template<typename Iterator >
void shuffle (Iterator begin, Iterator end)
 Draw uniformly distributed permutation and permute the given STL container.
 
template<class P >
auto decide (const P &p) -> typename detail::return_type< bool, P >::type
 Decide based on probability per value.
 
template<class P , class R >
decide (const P &p)
 Decide based on probability per value.
 
template<class P , class R >
void decide (const P &p, R &ret)
 Decide based on probability per value.
 
template<class P , class T >
auto decide_masked (const P &p, const T &mask) -> typename detail::return_type< bool, P >::type
 Decide based on probability per value.
 
template<class P , class T , class R >
decide_masked (const P &p, const T &mask)
 Decide based on probability per value.
 
template<class P , class T , class R >
void decide_masked (const P &p, const T &mask, R &ret)
 Decide based on probability per value.
 
double random ()
 Generate a random number \( 0 \leq r \leq 1 \).
 
template<class S >
auto random (const S &shape) -> typename detail::return_type< double, S >::type
 Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).
 
template<class R , class S >
random (const S &shape)
 Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).
 
template<class I , std::size_t L>
auto random (const I(&shape)[L]) -> typename detail::return_type_fixed< double, L >::type
 Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).
 
template<class R , class I , std::size_t L>
random (const I(&shape)[L])
 Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).
 
template<typename T >
randint (T high)
 Generate a random integer \( 0 \leq r < bound \).
 
template<class S , typename T >
auto randint (const S &shape, T high) -> typename detail::return_type< T, S >::type
 Generate an nd-array of random integers \( 0 \leq r \leq bound \).
 
template<class R , class S , typename T >
randint (const S &shape, T high)
 Generate an nd-array of random integers \( 0 \leq r \leq bound \).
 
template<class I , std::size_t L, typename T >
auto randint (const I(&shape)[L], T high) -> typename detail::return_type_fixed< T, L >::type
 Generate an nd-array of random integers \( 0 \leq r \leq bound \).
 
template<class R , class I , std::size_t L, typename T >
randint (const I(&shape)[L], T high)
 Generate an nd-array of random integers \( 0 \leq r \leq bound \).
 
template<class S , typename T , typename U >
auto randint (const S &shape, T low, U high) -> typename detail::return_type< T, S >::type
 Generate an nd-array of random integers \( low \leq r < high \).
 
template<class R , class S , typename T , typename U >
randint (const S &shape, T low, U high)
 Generate an nd-array of random integers \( low \leq r < high \).
 
template<class I , std::size_t L, typename T , typename U >
auto randint (const I(&shape)[L], T low, U high) -> typename detail::return_type_fixed< T, L >::type
 Generate an nd-array of random integers \( low \leq r < high \).
 
template<class R , class I , std::size_t L, typename T , typename U >
randint (const I(&shape)[L], T low, U high)
 Generate an nd-array of random integers \( low \leq r < high \).
 
double delta (double scale=1)
 Return a number distributed according to a delta distribution.
 
template<class S >
auto delta (const S &shape, double scale=1) -> typename detail::return_type< double, S >::type
 Generate an nd-array of numbers that are delta distribution.
 
template<class R , class S >
delta (const S &shape, double scale=1)
 Generate an nd-array of numbers that are delta distribution.
 
template<class I , std::size_t L>
auto delta (const I(&shape)[L], double scale=1) -> typename detail::return_type_fixed< double, L >::type
 Generate an nd-array of numbers that are delta distribution.
 
template<class R , class I , std::size_t L>
delta (const I(&shape)[L], double scale=1)
 Generate an nd-array of numbers that are delta distribution.
 
double exponential (double scale=1)
 Return a random number distributed according to an exponential distribution.
 
template<class S >
auto exponential (const S &shape, double scale=1) -> typename detail::return_type< double, S >::type
 Generate an nd-array of random numbers distributed according to an exponential distribution.
 
template<class R , class S >
exponential (const S &shape, double scale=1)
 Generate an nd-array of random numbers distributed according to an exponential distribution.
 
template<class I , std::size_t L>
auto exponential (const I(&shape)[L], double scale=1) -> typename detail::return_type_fixed< double, L >::type
 Generate an nd-array of random numbers distributed according to an exponential distribution.
 
template<class R , class I , std::size_t L>
exponential (const I(&shape)[L], double scale=1)
 Generate an nd-array of random numbers distributed according to an exponential distribution.
 
double power (double k=1)
 Return a random number distributed according to an power distribution.
 
template<class S >
auto power (const S &shape, double k=1) -> typename detail::return_type< double, S >::type
 Generate an nd-array of random numbers distributed according to an power distribution.
 
template<class R , class S >
power (const S &shape, double k=1)
 Generate an nd-array of random numbers distributed according to an power distribution.
 
template<class I , std::size_t L>
auto power (const I(&shape)[L], double k=1) -> typename detail::return_type_fixed< double, L >::type
 Generate an nd-array of random numbers distributed according to an power distribution.
 
template<class R , class I , std::size_t L>
power (const I(&shape)[L], double k=1)
 Generate an nd-array of random numbers distributed according to an power distribution.
 
double gamma (double k=1, double scale=1)
 Return a random number distributed according to a Gamma distribution.
 
template<class S >
auto gamma (const S &shape, double k=1, double scale=1) -> typename detail::return_type< double, S >::type
 Generate an nd-array of random numbers distributed according to a Gamma distribution.
 
template<class R , class S >
gamma (const S &shape, double k=1, double scale=1)
 Generate an nd-array of random numbers distributed according to a Gamma distribution.
 
template<class I , std::size_t L>
auto gamma (const I(&shape)[L], double k=1, double scale=1) -> typename detail::return_type_fixed< double, L >::type
 Generate an nd-array of random numbers distributed according to a Gamma distribution.
 
template<class R , class I , std::size_t L>
gamma (const I(&shape)[L], double k=1, double scale=1)
 Generate an nd-array of random numbers distributed according to a Gamma distribution.
 
double pareto (double k=1, double scale=1)
 Return a random number distributed according to a Pareto distribution.
 
template<class S >
auto pareto (const S &shape, double k=1, double scale=1) -> typename detail::return_type< double, S >::type
 Generate an nd-array of random numbers distributed according to a Pareto distribution.
 
template<class R , class S >
pareto (const S &shape, double k=1, double scale=1)
 Generate an nd-array of random numbers distributed according to a Pareto distribution.
 
template<class I , std::size_t L>
auto pareto (const I(&shape)[L], double k=1, double scale=1) -> typename detail::return_type_fixed< double, L >::type
 Generate an nd-array of random numbers distributed according to a Pareto distribution.
 
template<class R , class I , std::size_t L>
pareto (const I(&shape)[L], double k=1, double scale=1)
 Generate an nd-array of random numbers distributed according to a Pareto distribution.
 
double weibull (double k=1, double scale=1)
 Return a random number distributed according to a Weibull distribution.
 
template<class S >
auto weibull (const S &shape, double k=1, double scale=1) -> typename detail::return_type< double, S >::type
 Generate an nd-array of random numbers distributed according to a Weibull distribution.
 
template<class R , class S >
weibull (const S &shape, double k=1, double scale=1)
 Generate an nd-array of random numbers distributed according to a Weibull distribution.
 
template<class I , std::size_t L>
auto weibull (const I(&shape)[L], double k=1, double scale=1) -> typename detail::return_type_fixed< double, L >::type
 Generate an nd-array of random numbers distributed according to a Weibull distribution.
 
template<class R , class I , std::size_t L>
weibull (const I(&shape)[L], double k=1, double scale=1)
 Generate an nd-array of random numbers distributed according to a Weibull distribution.
 
double normal (double mu=0, double sigma=1)
 Return a random number distributed according to a normal distribution.
 
template<class S >
auto normal (const S &shape, double mu=0, double sigma=1) -> typename detail::return_type< double, S >::type
 Generate an nd-array of random numbers distributed according to a normal distribution.
 
template<class R , class S >
normal (const S &shape, double mu=0, double sigma=1)
 Generate an nd-array of random numbers distributed according to a normal distribution.
 
template<class I , std::size_t L>
auto normal (const I(&shape)[L], double mu=0, double sigma=1) -> typename detail::return_type_fixed< double, L >::type
 Generate an nd-array of random numbers distributed according to a normal distribution.
 
template<class R , class I , std::size_t L>
normal (const I(&shape)[L], double mu=0, double sigma=1)
 Generate an nd-array of random numbers distributed according to a normal distribution.
 
double draw (enum prrng::distribution distribution, std::vector< double > parameters=std::vector< double >{}, bool append_default=true)
 Get a random number according to some distribution.
 
template<class R , class S >
draw (const S &shape, enum prrng::distribution distribution, std::vector< double > parameters=std::vector< double >{}, bool append_default=true)
 Get an nd-array of random numbers according to some distribution.
 
double cumsum (size_t n, enum prrng::distribution distribution, std::vector< double > parameters=std::vector< double >{}, bool append_default=true)
 Get the cumulative sum of n random numbers according to some distribution.
 

Detailed Description

template<class Derived>
class prrng::GeneratorBase< Derived >

Base class of the pseudorandom number generators providing common methods.

If you want to implement a new generator, you should inherit from this class. The following minimal signature is required:

 class MyGenerator : public GeneratorBase<MyGenerator> {
 public:
     // Return next random number [0, 1).
     double next_double();

     // Return next random number (0, 1).
     double next_positive_double();

     // Return next random number [0, 2^32).
     uint32_t next_uint32();
 };
Template Parameters
DerivedDerived class.

Definition at line 1690 of file prrng.h.

Member Function Documentation

◆ cumsum()

template<class Derived >
double prrng::GeneratorBase< Derived >::cumsum ( size_t  n,
enum prrng::distribution  distribution,
std::vector< double >  parameters = std::vector<double>{},
bool  append_default = true 
)
inline

Get the cumulative sum of n random numbers according to some distribution.

Parameters
nNumber of random numbers to sum.
distributionType of distribution, see prrg::distribution.
parametersParameters for the distribution, see prrng::default_parameters.
append_defaultAppend default parameters to parameters.

Definition at line 2645 of file prrng.h.

◆ cumsum_delta()

template<class Derived >
double prrng::GeneratorBase< Derived >::cumsum_delta ( size_t  n,
double  scale = 1 
)
inline

Result of the cumulative sum of n 'random' numbers, distributed according to a delta distribution,.

Parameters
nNumber of steps.
scaleScale.
Returns
Cumulative sum.

Definition at line 1713 of file prrng.h.

◆ cumsum_exponential()

template<class Derived >
double prrng::GeneratorBase< Derived >::cumsum_exponential ( size_t  n,
double  scale = 1 
)
inline

Result of the cumulative sum of n random numbers, distributed according to an exponential distribution, see exponential_distribution(),.

Parameters
nNumber of steps.
scaleScale.
Returns
Cumulative sum.

Definition at line 1725 of file prrng.h.

◆ cumsum_gamma()

template<class Derived >
double prrng::GeneratorBase< Derived >::cumsum_gamma ( size_t  n,
double  k = 1,
double  scale = 1 
)
inline

Result of the cumulative sum of n random numbers, distributed according to a gamma distribution, see gamma_distribution(),.

Parameters
nNumber of steps.
kShape.
scaleScale.
Returns
Cumulative sum.

Definition at line 1759 of file prrng.h.

◆ cumsum_normal()

template<class Derived >
double prrng::GeneratorBase< Derived >::cumsum_normal ( size_t  n,
double  mu = 0,
double  sigma = 1 
)
inline

Result of the cumulative sum of n random numbers, distributed according to a normal distribution, see normal_distribution(),.

Parameters
nNumber of steps.
muMean.
sigmaStandard deviation.
Returns
Cumulative sum.

Definition at line 1818 of file prrng.h.

◆ cumsum_pareto()

template<class Derived >
double prrng::GeneratorBase< Derived >::cumsum_pareto ( size_t  n,
double  k = 1,
double  scale = 1 
)
inline

Result of the cumulative sum of n random numbers, distributed according to a Pareto distribution, see pareto_distribution(),.

Parameters
nNumber of steps.
kShape.
scaleScale.
Returns
Cumulative sum.

Definition at line 1782 of file prrng.h.

◆ cumsum_power()

template<class Derived >
double prrng::GeneratorBase< Derived >::cumsum_power ( size_t  n,
double  k = 1 
)
inline

Result of the cumulative sum of n random numbers, distributed according to a power distribution, see power_distribution(),.

Parameters
nNumber of steps.
kScale.
Returns
Cumulative sum.

Definition at line 1741 of file prrng.h.

◆ cumsum_random()

template<class Derived >
double prrng::GeneratorBase< Derived >::cumsum_random ( size_t  n)
inline

Result of the cumulative sum of n random numbers.

Parameters
nNumber of steps.
Returns
Cumulative sum.

Definition at line 1697 of file prrng.h.

◆ cumsum_weibull()

template<class Derived >
double prrng::GeneratorBase< Derived >::cumsum_weibull ( size_t  n,
double  k = 1,
double  scale = 1 
)
inline

Result of the cumulative sum of n random numbers, distributed according to a weibull distribution, see weibull_distribution(),.

Parameters
nNumber of steps.
kShape.
scaleScale.
Returns
Cumulative sum.

Definition at line 1800 of file prrng.h.

◆ decide() [1/3]

template<class Derived >
template<class P , class R >
R prrng::GeneratorBase< Derived >::decide ( const P &  p)
inline

Decide based on probability per value.

This is fully equivalent to generator.random(p.shape) < p, but avoids the memory allocation of random.

Parameters
pProbability per value [0, 1].
Returns
Decision for each p.

Definition at line 1874 of file prrng.h.

◆ decide() [2/3]

template<class Derived >
template<class P >
auto prrng::GeneratorBase< Derived >::decide ( const P &  p) -> typename detail::return_type<bool, P>::type
inline

Decide based on probability per value.

This is fully equivalent to generator.random(p.shape) < p, but avoids the memory allocation of random.

Parameters
pProbability per value [0, 1].
Returns
Decision for each p.

Definition at line 1862 of file prrng.h.

◆ decide() [3/3]

template<class Derived >
template<class P , class R >
void prrng::GeneratorBase< Derived >::decide ( const P &  p,
R &  ret 
)
inline

Decide based on probability per value.

This is fully equivalent to generator.random(p.shape) < p, but avoids the memory allocation of random.

Parameters
pProbability per value [0, 1].
retDecision for each p.

Definition at line 1891 of file prrng.h.

◆ decide_masked() [1/3]

template<class Derived >
template<class P , class T , class R >
R prrng::GeneratorBase< Derived >::decide_masked ( const P &  p,
const T &  mask 
)
inline

Decide based on probability per value.

This is fully equivalent to generator.random(p.shape) < p, but avoids the memory allocation of random.

Parameters
pProbability per value [0, 1].
maskWhere true the decision is false (no random number is drawn there).
Returns
Decision for each p.

Definition at line 1928 of file prrng.h.

◆ decide_masked() [2/3]

template<class Derived >
template<class P , class T >
auto prrng::GeneratorBase< Derived >::decide_masked ( const P &  p,
const T &  mask 
) -> typename detail::return_type<bool, P>::type
inline

Decide based on probability per value.

This is fully equivalent to generator.random(p.shape) < p, but avoids the memory allocation of random.

Parameters
pProbability per value [0, 1].
maskWhere true the decision is false (no random number is drawn there).
Returns
Decision for each p.

Definition at line 1916 of file prrng.h.

◆ decide_masked() [3/3]

template<class Derived >
template<class P , class T , class R >
void prrng::GeneratorBase< Derived >::decide_masked ( const P &  p,
const T &  mask,
R &  ret 
)
inline

Decide based on probability per value.

This is fully equivalent to generator.random(p.shape) < p, but avoids the memory allocation of random.

Parameters
pProbability per value [0, 1].
maskWhere true the decision is false (no random number is drawn there).
retDecision for each p.

Definition at line 1946 of file prrng.h.

◆ delta() [1/5]

template<class Derived >
template<class R , class I , std::size_t L>
R prrng::GeneratorBase< Derived >::delta ( const I(&)  shape[L],
double  scale = 1 
)
inline

Generate an nd-array of numbers that are delta distribution.

These numbers are not random; calling this function does not change the state of the generators.

Parameters
shapeThe shape of the nd-array.
scaleThe value of the 'peak' of the delta distribution.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2177 of file prrng.h.

◆ delta() [2/5]

template<class Derived >
template<class I , std::size_t L>
auto prrng::GeneratorBase< Derived >::delta ( const I(&)  shape[L],
double  scale = 1 
) -> typename detail::return_type_fixed<double, L>::type
inline

Generate an nd-array of numbers that are delta distribution.

These numbers are not random; calling this function does not change the state of the generators.

Parameters
shapeThe shape of the nd-array.
scaleThe value of the 'peak' of the delta distribution.
Returns
The sample of shape shape.

Definition at line 2165 of file prrng.h.

◆ delta() [3/5]

template<class Derived >
template<class R , class S >
R prrng::GeneratorBase< Derived >::delta ( const S &  shape,
double  scale = 1 
)
inline

Generate an nd-array of numbers that are delta distribution.

These numbers are not random; calling this function does not change the state of the generators.

Parameters
shapeThe shape of the nd-array.
scaleThe value of the 'peak' of the delta distribution.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2156 of file prrng.h.

◆ delta() [4/5]

template<class Derived >
template<class S >
auto prrng::GeneratorBase< Derived >::delta ( const S &  shape,
double  scale = 1 
) -> typename detail::return_type<double, S>::type
inline

Generate an nd-array of numbers that are delta distribution.

These numbers are not random; calling this function does not change the state of the generators.

Parameters
shapeThe shape of the nd-array.
scaleThe value of the 'peak' of the delta distribution.
Returns
The sample of shape shape.

Definition at line 2145 of file prrng.h.

◆ delta() [5/5]

template<class Derived >
double prrng::GeneratorBase< Derived >::delta ( double  scale = 1)
inline

Return a number distributed according to a delta distribution.

Parameters
scaleThe value of the 'peak' of the delta distribution.
Returns
Random number.

Definition at line 2130 of file prrng.h.

◆ draw() [1/2]

template<class Derived >
template<class R , class S >
R prrng::GeneratorBase< Derived >::draw ( const S &  shape,
enum prrng::distribution  distribution,
std::vector< double >  parameters = std::vector<double>{},
bool  append_default = true 
)
inline

Get an nd-array of random numbers according to some distribution.

Parameters
shapeThe shape of the nd-array.
distributionType of distribution, see prrg::distribution.
parametersParameters for the distribution, see prrng::default_parameters.
append_defaultAppend default parameters to parameters.s

Definition at line 2599 of file prrng.h.

◆ draw() [2/2]

template<class Derived >
double prrng::GeneratorBase< Derived >::draw ( enum prrng::distribution  distribution,
std::vector< double >  parameters = std::vector<double>{},
bool  append_default = true 
)
inline

Get a random number according to some distribution.

Parameters
distributionType of distribution, see prrg::distribution.
parametersParameters for the distribution, see prrng::default_parameters.
append_defaultAppend default parameters to parameters.

Definition at line 2553 of file prrng.h.

◆ exponential() [1/5]

template<class Derived >
template<class R , class I , std::size_t L>
R prrng::GeneratorBase< Derived >::exponential ( const I(&)  shape[L],
double  scale = 1 
)
inline

Generate an nd-array of random numbers distributed according to an exponential distribution.

Parameters
shapeThe shape of the nd-array.
scaleScale.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2234 of file prrng.h.

◆ exponential() [2/5]

template<class Derived >
template<class I , std::size_t L>
auto prrng::GeneratorBase< Derived >::exponential ( const I(&)  shape[L],
double  scale = 1 
) -> typename detail::return_type_fixed<double, L>::type
inline

Generate an nd-array of random numbers distributed according to an exponential distribution.

Parameters
shapeThe shape of the nd-array.
scaleScale.
Returns
The sample of shape shape.

Definition at line 2222 of file prrng.h.

◆ exponential() [3/5]

template<class Derived >
template<class R , class S >
R prrng::GeneratorBase< Derived >::exponential ( const S &  shape,
double  scale = 1 
)
inline

Generate an nd-array of random numbers distributed according to an exponential distribution.

Parameters
shapeThe shape of the nd-array.
scaleScale.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2213 of file prrng.h.

◆ exponential() [4/5]

template<class Derived >
template<class S >
auto prrng::GeneratorBase< Derived >::exponential ( const S &  shape,
double  scale = 1 
) -> typename detail::return_type<double, S>::type
inline

Generate an nd-array of random numbers distributed according to an exponential distribution.

Parameters
shapeThe shape of the nd-array.
scaleScale.
Returns
The sample of shape shape.

Definition at line 2201 of file prrng.h.

◆ exponential() [5/5]

template<class Derived >
double prrng::GeneratorBase< Derived >::exponential ( double  scale = 1)
inline

Return a random number distributed according to an exponential distribution.

Parameters
scaleScale.
Returns
Random number.

Definition at line 2188 of file prrng.h.

◆ gamma() [1/5]

template<class Derived >
template<class R , class I , std::size_t L>
R prrng::GeneratorBase< Derived >::gamma ( const I(&)  shape[L],
double  k = 1,
double  scale = 1 
)
inline

Generate an nd-array of random numbers distributed according to a Gamma distribution.

Only available when compiled with PRRNG_USE_BOOST.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2356 of file prrng.h.

◆ gamma() [2/5]

template<class Derived >
template<class I , std::size_t L>
auto prrng::GeneratorBase< Derived >::gamma ( const I(&)  shape[L],
double  k = 1,
double  scale = 1 
) -> typename detail::return_type_fixed<double, L>::type
inline

Generate an nd-array of random numbers distributed according to a Gamma distribution.

Only available when compiled with PRRNG_USE_BOOST.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.

Definition at line 2344 of file prrng.h.

◆ gamma() [3/5]

template<class Derived >
template<class R , class S >
R prrng::GeneratorBase< Derived >::gamma ( const S &  shape,
double  k = 1,
double  scale = 1 
)
inline

Generate an nd-array of random numbers distributed according to a Gamma distribution.

Only available when compiled with PRRNG_USE_BOOST.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2335 of file prrng.h.

◆ gamma() [4/5]

template<class Derived >
template<class S >
auto prrng::GeneratorBase< Derived >::gamma ( const S &  shape,
double  k = 1,
double  scale = 1 
) -> typename detail::return_type<double, S>::type
inline

Generate an nd-array of random numbers distributed according to a Gamma distribution.

Only available when compiled with PRRNG_USE_BOOST.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.

Definition at line 2323 of file prrng.h.

◆ gamma() [5/5]

template<class Derived >
double prrng::GeneratorBase< Derived >::gamma ( double  k = 1,
double  scale = 1 
)
inline

Return a random number distributed according to a Gamma distribution.

Parameters
kShape parameter.
scaleScale parameter.
Returns
Random number.

Definition at line 2302 of file prrng.h.

◆ normal() [1/5]

template<class Derived >
template<class R , class I , std::size_t L>
R prrng::GeneratorBase< Derived >::normal ( const I(&)  shape[L],
double  mu = 0,
double  sigma = 1 
)
inline

Generate an nd-array of random numbers distributed according to a normal distribution.

Parameters
shapeThe shape of the nd-array.
muThe average.
sigmaThe standard deviation.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2541 of file prrng.h.

◆ normal() [2/5]

template<class Derived >
template<class I , std::size_t L>
auto prrng::GeneratorBase< Derived >::normal ( const I(&)  shape[L],
double  mu = 0,
double  sigma = 1 
) -> typename detail::return_type_fixed<double, L>::type
inline

Generate an nd-array of random numbers distributed according to a normal distribution.

Parameters
shapeThe shape of the nd-array.
muThe average.
sigmaThe standard deviation.
Returns
The sample of shape shape.

Definition at line 2529 of file prrng.h.

◆ normal() [3/5]

template<class Derived >
template<class R , class S >
R prrng::GeneratorBase< Derived >::normal ( const S &  shape,
double  mu = 0,
double  sigma = 1 
)
inline

Generate an nd-array of random numbers distributed according to a normal distribution.

Parameters
shapeThe shape of the nd-array.
muThe average.
sigmaThe standard deviation.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2520 of file prrng.h.

◆ normal() [4/5]

template<class Derived >
template<class S >
auto prrng::GeneratorBase< Derived >::normal ( const S &  shape,
double  mu = 0,
double  sigma = 1 
) -> typename detail::return_type<double, S>::type
inline

Generate an nd-array of random numbers distributed according to a normal distribution.

Parameters
shapeThe shape of the nd-array.
muThe average.
sigmaThe standard deviation.
Returns
The sample of shape shape.

Definition at line 2508 of file prrng.h.

◆ normal() [5/5]

template<class Derived >
double prrng::GeneratorBase< Derived >::normal ( double  mu = 0,
double  sigma = 1 
)
inline

Return a random number distributed according to a normal distribution.

Parameters
muThe average.
sigmaThe standard deviation.
Returns
Random number.

Definition at line 2487 of file prrng.h.

◆ pareto() [1/5]

template<class Derived >
template<class R , class I , std::size_t L>
R prrng::GeneratorBase< Derived >::pareto ( const I(&)  shape[L],
double  k = 1,
double  scale = 1 
)
inline

Generate an nd-array of random numbers distributed according to a Pareto distribution.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2415 of file prrng.h.

◆ pareto() [2/5]

template<class Derived >
template<class I , std::size_t L>
auto prrng::GeneratorBase< Derived >::pareto ( const I(&)  shape[L],
double  k = 1,
double  scale = 1 
) -> typename detail::return_type_fixed<double, L>::type
inline

Generate an nd-array of random numbers distributed according to a Pareto distribution.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.

Definition at line 2403 of file prrng.h.

◆ pareto() [3/5]

template<class Derived >
template<class R , class S >
R prrng::GeneratorBase< Derived >::pareto ( const S &  shape,
double  k = 1,
double  scale = 1 
)
inline

Generate an nd-array of random numbers distributed according to a Pareto distribution.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2394 of file prrng.h.

◆ pareto() [4/5]

template<class Derived >
template<class S >
auto prrng::GeneratorBase< Derived >::pareto ( const S &  shape,
double  k = 1,
double  scale = 1 
) -> typename detail::return_type<double, S>::type
inline

Generate an nd-array of random numbers distributed according to a Pareto distribution.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.

Definition at line 2382 of file prrng.h.

◆ pareto() [5/5]

template<class Derived >
double prrng::GeneratorBase< Derived >::pareto ( double  k = 1,
double  scale = 1 
)
inline

Return a random number distributed according to a Pareto distribution.

Parameters
kShape parameter.
scaleScale parameter.
Returns
Random number.

Definition at line 2368 of file prrng.h.

◆ power() [1/5]

template<class Derived >
template<class R , class I , std::size_t L>
R prrng::GeneratorBase< Derived >::power ( const I(&)  shape[L],
double  k = 1 
)
inline

Generate an nd-array of random numbers distributed according to an power distribution.

Parameters
shapeThe shape of the nd-array.
kScale.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2290 of file prrng.h.

◆ power() [2/5]

template<class Derived >
template<class I , std::size_t L>
auto prrng::GeneratorBase< Derived >::power ( const I(&)  shape[L],
double  k = 1 
) -> typename detail::return_type_fixed<double, L>::type
inline

Generate an nd-array of random numbers distributed according to an power distribution.

Parameters
shapeThe shape of the nd-array.
kScale.
Returns
The sample of shape shape.

Definition at line 2278 of file prrng.h.

◆ power() [3/5]

template<class Derived >
template<class R , class S >
R prrng::GeneratorBase< Derived >::power ( const S &  shape,
double  k = 1 
)
inline

Generate an nd-array of random numbers distributed according to an power distribution.

Parameters
shapeThe shape of the nd-array.
kScale.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2269 of file prrng.h.

◆ power() [4/5]

template<class Derived >
template<class S >
auto prrng::GeneratorBase< Derived >::power ( const S &  shape,
double  k = 1 
) -> typename detail::return_type<double, S>::type
inline

Generate an nd-array of random numbers distributed according to an power distribution.

Parameters
shapeThe shape of the nd-array.
kScale.
Returns
The sample of shape shape.

Definition at line 2258 of file prrng.h.

◆ power() [5/5]

template<class Derived >
double prrng::GeneratorBase< Derived >::power ( double  k = 1)
inline

Return a random number distributed according to an power distribution.

Parameters
kScale.
Returns
Random number.

Definition at line 2245 of file prrng.h.

◆ randint() [1/9]

template<class Derived >
template<class R , class I , std::size_t L, typename T >
R prrng::GeneratorBase< Derived >::randint ( const I(&)  shape[L],
high 
)
inline

Generate an nd-array of random integers \( 0 \leq r \leq bound \).

Parameters
shapeThe shape of the nd-array.
highThe upper bound of the random integers.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<uint32_t, 1>

Definition at line 2073 of file prrng.h.

◆ randint() [2/9]

template<class Derived >
template<class I , std::size_t L, typename T >
auto prrng::GeneratorBase< Derived >::randint ( const I(&)  shape[L],
high 
) -> typename detail::return_type_fixed<T, L>::type
inline

Generate an nd-array of random integers \( 0 \leq r \leq bound \).

Parameters
shapeThe shape of the nd-array.
highThe upper bound of the random integers.
Returns
The sample of shape shape.

Definition at line 2062 of file prrng.h.

◆ randint() [3/9]

template<class Derived >
template<class R , class I , std::size_t L, typename T , typename U >
R prrng::GeneratorBase< Derived >::randint ( const I(&)  shape[L],
low,
high 
)
inline

Generate an nd-array of random integers \( low \leq r < high \).

Parameters
shapeThe shape of the nd-array.
lowThe lower bound of the random integers.
highThe upper bound of the random integers.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<uint32_t, 1>

Definition at line 2119 of file prrng.h.

◆ randint() [4/9]

template<class Derived >
template<class I , std::size_t L, typename T , typename U >
auto prrng::GeneratorBase< Derived >::randint ( const I(&)  shape[L],
low,
high 
) -> typename detail::return_type_fixed<T, L>::type
inline

Generate an nd-array of random integers \( low \leq r < high \).

Parameters
shapeThe shape of the nd-array.
lowThe lower bound of the random integers.
highThe upper bound of the random integers.
Returns
The sample of shape shape.

Definition at line 2107 of file prrng.h.

◆ randint() [5/9]

template<class Derived >
template<class R , class S , typename T >
R prrng::GeneratorBase< Derived >::randint ( const S &  shape,
high 
)
inline

Generate an nd-array of random integers \( 0 \leq r \leq bound \).

Parameters
shapeThe shape of the nd-array.
highThe upper bound of the random integers.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2053 of file prrng.h.

◆ randint() [6/9]

template<class Derived >
template<class S , typename T >
auto prrng::GeneratorBase< Derived >::randint ( const S &  shape,
high 
) -> typename detail::return_type<T, S>::type
inline

Generate an nd-array of random integers \( 0 \leq r \leq bound \).

Parameters
shapeThe shape of the nd-array.
highThe upper bound of the random integers.
Returns
The sample of shape shape.

Definition at line 2042 of file prrng.h.

◆ randint() [7/9]

template<class Derived >
template<class R , class S , typename T , typename U >
R prrng::GeneratorBase< Derived >::randint ( const S &  shape,
low,
high 
)
inline

Generate an nd-array of random integers \( low \leq r < high \).

Parameters
shapeThe shape of the nd-array.
lowThe lower bound of the random integers.
highThe upper bound of the random integers.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2098 of file prrng.h.

◆ randint() [8/9]

template<class Derived >
template<class S , typename T , typename U >
auto prrng::GeneratorBase< Derived >::randint ( const S &  shape,
low,
high 
) -> typename detail::return_type<T, S>::type
inline

Generate an nd-array of random integers \( low \leq r < high \).

Parameters
shapeThe shape of the nd-array.
lowThe lower bound of the random integers.
highThe upper bound of the random integers.
Returns
The sample of shape shape.

Definition at line 2087 of file prrng.h.

◆ randint() [9/9]

template<class Derived >
template<typename T >
T prrng::GeneratorBase< Derived >::randint ( high)
inline

Generate a random integer \( 0 \leq r < bound \).

Parameters
highThe upper bound of the random integers.
Returns
Random number.

Definition at line 2024 of file prrng.h.

◆ random() [1/5]

template<class Derived >
double prrng::GeneratorBase< Derived >::random ( )
inline

Generate a random number \( 0 \leq r \leq 1 \).

Returns
Random number.

Definition at line 1969 of file prrng.h.

◆ random() [2/5]

template<class Derived >
template<class R , class I , std::size_t L>
R prrng::GeneratorBase< Derived >::random ( const I(&)  shape[L])
inline

Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).

Parameters
shapeThe shape of the nd-array.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2012 of file prrng.h.

◆ random() [3/5]

template<class Derived >
template<class I , std::size_t L>
auto prrng::GeneratorBase< Derived >::random ( const I(&)  shape[L]) -> typename detail::return_type_fixed<double, L>::type
inline

Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).

Parameters
shapeThe shape of the nd-array.
Returns
The sample of shape shape.

Definition at line 2001 of file prrng.h.

◆ random() [4/5]

template<class Derived >
template<class R , class S >
R prrng::GeneratorBase< Derived >::random ( const S &  shape)
inline

Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).

Parameters
shapeThe shape of the nd-array.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 1992 of file prrng.h.

◆ random() [5/5]

template<class Derived >
template<class S >
auto prrng::GeneratorBase< Derived >::random ( const S &  shape) -> typename detail::return_type<double, S>::type
inline

Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).

Parameters
shapeThe shape of the nd-array.
Returns
The sample of shape shape.

Definition at line 1981 of file prrng.h.

◆ shuffle()

template<class Derived >
template<typename Iterator >
void prrng::GeneratorBase< Derived >::shuffle ( Iterator  begin,
Iterator  end 
)
inline

Draw uniformly distributed permutation and permute the given STL container.

Parameters
beginIterator to the beginning of the container.
endIterator to the end of the container.
Note
From: Knuth, TAoCP Vol. 2 (3rd 3d), Section 3.4.2
Author
Wenzel Jakob, https://github.com/wjakob/pcg32.

Definition at line 1844 of file prrng.h.

◆ weibull() [1/5]

template<class Derived >
template<class R , class I , std::size_t L>
R prrng::GeneratorBase< Derived >::weibull ( const I(&)  shape[L],
double  k = 1,
double  scale = 1 
)
inline

Generate an nd-array of random numbers distributed according to a Weibull distribution.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2475 of file prrng.h.

◆ weibull() [2/5]

template<class Derived >
template<class I , std::size_t L>
auto prrng::GeneratorBase< Derived >::weibull ( const I(&)  shape[L],
double  k = 1,
double  scale = 1 
) -> typename detail::return_type_fixed<double, L>::type
inline

Generate an nd-array of random numbers distributed according to a Weibull distribution.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.

Definition at line 2463 of file prrng.h.

◆ weibull() [3/5]

template<class Derived >
template<class R , class S >
R prrng::GeneratorBase< Derived >::weibull ( const S &  shape,
double  k = 1,
double  scale = 1 
)
inline

Generate an nd-array of random numbers distributed according to a Weibull distribution.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.
Template Parameters
Rreturn type, e.g. xt::xtensor<double, 1>

Definition at line 2454 of file prrng.h.

◆ weibull() [4/5]

template<class Derived >
template<class S >
auto prrng::GeneratorBase< Derived >::weibull ( const S &  shape,
double  k = 1,
double  scale = 1 
) -> typename detail::return_type<double, S>::type
inline

Generate an nd-array of random numbers distributed according to a Weibull distribution.

Parameters
shapeThe shape of the nd-array.
kShape parameter.
scaleScale parameter.
Returns
The sample of shape shape.

Definition at line 2442 of file prrng.h.

◆ weibull() [5/5]

template<class Derived >
double prrng::GeneratorBase< Derived >::weibull ( double  k = 1,
double  scale = 1 
)
inline

Return a random number distributed according to a Weibull distribution.

Parameters
kShape parameter.
scaleScale parameter.
Returns
Random number.

Definition at line 2427 of file prrng.h.


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