NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::random::RNG< GeneratorType > Class Template Reference

#include <RNG.hpp>

Public Member Functions

 RNG ()=default
 
 RNG (int seed)
 
NdArray< bool > bernoulli (const Shape &inShape, double inP=0.5)
 
bool bernoulli (double inP=0.5)
 
template<typename dtype >
NdArray< dtype > beta (const Shape &inShape, dtype inAlpha, dtype inBeta)
 
template<typename dtype >
dtype beta (dtype inAlpha, dtype inBeta)
 
template<typename dtype >
NdArray< dtype > binomial (const Shape &inShape, dtype inN, double inP=0.5)
 
template<typename dtype >
dtype binomial (dtype inN, double inP=0.5)
 
template<typename dtype >
NdArray< dtype > cauchy (const Shape &inShape, dtype inMean=0, dtype inSigma=1)
 
template<typename dtype >
dtype cauchy (dtype inMean=0, dtype inSigma=1)
 
template<typename dtype >
NdArray< dtype > chiSquare (const Shape &inShape, dtype inDof)
 
template<typename dtype >
dtype chiSquare (dtype inDof)
 
template<typename dtype >
dtype choice (const NdArray< dtype > &inArray)
 
template<typename dtype >
NdArray< dtype > choice (const NdArray< dtype > &inArray, uint32 inNum, Replace replace=Replace::YES)
 
template<typename dtype >
dtype discrete (const NdArray< double > &inWeights)
 
template<typename dtype >
NdArray< dtype > discrete (const Shape &inShape, const NdArray< double > &inWeights)
 
template<typename dtype >
NdArray< dtype > exponential (const Shape &inShape, dtype inScaleValue=1)
 
template<typename dtype >
dtype exponential (dtype inScaleValue=1)
 
template<typename dtype >
NdArray< dtype > extremeValue (const Shape &inShape, dtype inA=1, dtype inB=1)
 
template<typename dtype >
dtype extremeValue (dtype inA=1, dtype inB=1)
 
template<typename dtype >
NdArray< dtype > f (const Shape &inShape, dtype inDofN, dtype inDofD)
 
template<typename dtype >
dtype f (dtype inDofN, dtype inDofD)
 
template<typename dtype >
NdArray< dtype > gamma (const Shape &inShape, dtype inGammaShape, dtype inScaleValue=1)
 
template<typename dtype >
dtype gamma (dtype inGammaShape, dtype inScaleValue=1)
 
template<typename dtype >
NdArray< dtype > geometric (const Shape &inShape, double inP=0.5)
 
template<typename dtype >
dtype geometric (double inP=0.5)
 
template<typename dtype >
NdArray< dtype > laplace (const Shape &inShape, dtype inLoc=0, dtype inScale=1)
 
template<typename dtype >
dtype laplace (dtype inLoc=0, dtype inScale=1)
 
template<typename dtype >
NdArray< dtype > lognormal (const Shape &inShape, dtype inMean=0, dtype inSigma=1)
 
template<typename dtype >
dtype lognormal (dtype inMean=0, dtype inSigma=1)
 
template<typename dtype >
NdArray< dtype > negativeBinomial (const Shape &inShape, dtype inN, double inP=0.5)
 
template<typename dtype >
dtype negativeBinomial (dtype inN, double inP=0.5)
 
template<typename dtype >
NdArray< dtype > nonCentralChiSquared (const Shape &inShape, dtype inK=1, dtype inLambda=1)
 
template<typename dtype >
dtype nonCentralChiSquared (dtype inK=1, dtype inLambda=1)
 
template<typename dtype >
NdArray< dtype > normal (const Shape &inShape, dtype inMean=0, dtype inSigma=1)
 
template<typename dtype >
dtype normal (dtype inMean=0, dtype inSigma=1)
 
template<typename dtype >
NdArray< dtype > permutation (const NdArray< dtype > &inArray)
 
template<typename dtype >
NdArray< dtype > permutation (dtype inValue)
 
template<typename dtype >
NdArray< dtype > poisson (const Shape &inShape, double inMean=1)
 
template<typename dtype >
dtype poisson (double inMean=1)
 
template<typename dtype >
dtype rand ()
 
template<typename dtype >
NdArray< dtype > rand (const Shape &inShape)
 
template<typename dtype >
NdArray< dtype > randFloat (const Shape &inShape, dtype inLow, dtype inHigh=0.)
 
template<typename dtype >
dtype randFloat (dtype inLow, dtype inHigh=0.)
 
template<typename dtype >
NdArray< dtype > randInt (const Shape &inShape, dtype inLow, dtype inHigh=0)
 
template<typename dtype >
dtype randInt (dtype inLow, dtype inHigh=0)
 
template<typename dtype >
dtype randN ()
 
template<typename dtype >
NdArray< dtype > randN (const Shape &inShape)
 
void seed (int value) noexcept
 
template<typename dtype >
void shuffle (NdArray< dtype > &inArray)
 
template<typename dtype >
dtype standardNormal ()
 
template<typename dtype >
NdArray< dtype > standardNormal (const Shape &inShape)
 
template<typename dtype >
NdArray< dtype > studentT (const Shape &inShape, dtype inDof)
 
template<typename dtype >
dtype studentT (dtype inDof)
 
template<typename dtype >
NdArray< dtype > triangle (const Shape &inShape, dtype inA=0, dtype inB=0.5, dtype inC=1)
 
template<typename dtype >
dtype triangle (dtype inA=0, dtype inB=0.5, dtype inC=1)
 
template<typename dtype >
NdArray< dtype > uniform (const Shape &inShape, dtype inLow, dtype inHigh)
 
template<typename dtype >
dtype uniform (dtype inLow, dtype inHigh)
 
template<typename dtype >
NdArray< dtype > uniformOnSphere (uint32 inNumPoints, uint32 inDims=2)
 
template<typename dtype >
NdArray< dtype > weibull (const Shape &inShape, dtype inA=1, dtype inB=1)
 
template<typename dtype >
dtype weibull (dtype inA=1, dtype inB=1)
 

Detailed Description

template<typename GeneratorType = std::mt19937_64>
class nc::random::RNG< GeneratorType >

Random Number Generater Class with non-global state

Constructor & Destructor Documentation

◆ RNG() [1/2]

template<typename GeneratorType = std::mt19937_64>
nc::random::RNG< GeneratorType >::RNG ( )
default

Defualt Constructor

◆ RNG() [2/2]

template<typename GeneratorType = std::mt19937_64>
nc::random::RNG< GeneratorType >::RNG ( int  seed)
inlineexplicit

Seed Constructor

Parameters
seedthe seed value

Member Function Documentation

◆ bernoulli() [1/2]

template<typename GeneratorType = std::mt19937_64>
NdArray< bool > nc::random::RNG< GeneratorType >::bernoulli ( const Shape inShape,
double  inP = 0.5 
)
inline

Create an array of the given shape and populate it with random samples from the "bernoulli" distribution.

Parameters
inShape
inP(probability of success [0, 1]). Default 0.5
Returns
NdArray

◆ bernoulli() [2/2]

template<typename GeneratorType = std::mt19937_64>
bool nc::random::RNG< GeneratorType >::bernoulli ( double  inP = 0.5)
inline

Single random value sampled from the "bernoulli" distribution.

Parameters
inP(probability of success [0, 1]). Default 0.5
Returns
NdArray

◆ beta() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::beta ( const Shape inShape,
dtype  inAlpha,
dtype  inBeta 
)
inline

Create an array of the given shape and populate it with random samples from the "beta" distribution. NOTE: Use of this function requires using the Boost includes.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.beta.html#numpy.random.beta

Parameters
inShape
inAlpha
inBeta
Returns
NdArray

◆ beta() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::beta ( dtype  inAlpha,
dtype  inBeta 
)
inline

Single random value sampled from the from the "beta" distribution. NOTE: Use of this function requires using the Boost includes.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.beta.html#numpy.random.beta

Parameters
inAlpha
inBeta
Returns
NdArray

◆ binomial() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::binomial ( const Shape inShape,
dtype  inN,
double  inP = 0.5 
)
inline

Create an array of the given shape and populate it with random samples from the "binomial" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.binomial.html#numpy.random.binomial

Parameters
inShape
inN(number of trials)
inP(probablity of success [0, 1])
Returns
NdArray

◆ binomial() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::binomial ( dtype  inN,
double  inP = 0.5 
)
inline

Single random value sampled from the from the "binomial" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.binomial.html#numpy.random.binomial

Parameters
inN(number of trials)
inP(probablity of success [0, 1])
Returns
NdArray

◆ cauchy() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::cauchy ( const Shape inShape,
dtype  inMean = 0,
dtype  inSigma = 1 
)
inline

Create an array of the given shape and populate it with random samples from a "cauchy" distrubution.

Parameters
inShape
inMeanMean value of the underlying normal distribution. Default is 0.
inSigmaStandard deviation of the underlying normal distribution. Should be greater than zero. Default is 1.
Returns
NdArray

◆ cauchy() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::cauchy ( dtype  inMean = 0,
dtype  inSigma = 1 
)
inline

Single random value sampled from the from the "cauchy" distrubution.

Parameters
inMeanMean value of the underlying normal distribution. Default is 0.
inSigmaStandard deviation of the underlying normal distribution. Should be greater than zero. Default is 1.
Returns
NdArray

◆ chiSquare() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::chiSquare ( const Shape inShape,
dtype  inDof 
)
inline

Create an array of the given shape and populate it with random samples from the "chi square" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.chisquare.html#numpy.random.chisquare

Parameters
inShape
inDof(independent random variables)
Returns
NdArray

◆ chiSquare() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::chiSquare ( dtype  inDof)
inline

Single random value sampled from the from the "chi square" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.chisquare.html#numpy.random.chisquare

Parameters
inDof(independent random variables)
Returns
NdArray

◆ choice() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::choice ( const NdArray< dtype > &  inArray)
inline

Chooses a random sample from an input array.

Parameters
inArray
Returns
NdArray

◆ choice() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::choice ( const NdArray< dtype > &  inArray,
uint32  inNum,
Replace  replace = Replace::YES 
)
inline

Chooses inNum random samples from an input array.

Parameters
inArray
inNum
replaceWhether the sample is with or without replacement
Returns
NdArray

◆ discrete() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::discrete ( const NdArray< double > &  inWeights)
inline

Single random value sampled from the from the "discrete" distrubution. It produces integers in the range [0, n) with the probability of producing each value is specified by the parameters of the distribution.

Parameters
inWeights
Returns
NdArray

◆ discrete() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::discrete ( const Shape inShape,
const NdArray< double > &  inWeights 
)
inline

Create an array of the given shape and populate it with random samples from a "discrete" distrubution. It produces integers in the range [0, n) with the probability of producing each value is specified by the parameters of the distribution.

Parameters
inShape
inWeights
Returns
NdArray

◆ exponential() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::exponential ( const Shape inShape,
dtype  inScaleValue = 1 
)
inline

Create an array of the given shape and populate it with random samples from a "exponential" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.exponential.html#numpy.random.exponential

Parameters
inShape
inScaleValue(default 1)
Returns
NdArray

◆ exponential() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::exponential ( dtype  inScaleValue = 1)
inline

Single random value sampled from the "exponential" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.exponential.html#numpy.random.exponential

Parameters
inScaleValue(default 1)
Returns
NdArray

◆ extremeValue() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::extremeValue ( const Shape inShape,
dtype  inA = 1,
dtype  inB = 1 
)
inline

Create an array of the given shape and populate it with random samples from a "extreme value" distrubution.

Parameters
inShape
inA(default 1)
inB(default 1)
Returns
NdArray

◆ extremeValue() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::extremeValue ( dtype  inA = 1,
dtype  inB = 1 
)
inline

Single random value sampled from the "extreme value" distrubution.

Parameters
inA(default 1)
inB(default 1)
Returns
NdArray

◆ f() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::f ( const Shape inShape,
dtype  inDofN,
dtype  inDofD 
)
inline

Create an array of the given shape and populate it with random samples from a "F" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.f.html#numpy.random.f

Parameters
inShape
inDofNDegrees of freedom in numerator. Should be greater than zero.
inDofDDegrees of freedom in denominator. Should be greater than zero.
Returns
NdArray

◆ f() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::f ( dtype  inDofN,
dtype  inDofD 
)
inline

Single random value sampled from the "F" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.f.html#numpy.random.f

Parameters
inDofNDegrees of freedom in numerator. Should be greater than zero.
inDofDDegrees of freedom in denominator. Should be greater than zero.
Returns
NdArray

◆ gamma() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::gamma ( const Shape inShape,
dtype  inGammaShape,
dtype  inScaleValue = 1 
)
inline

Create an array of the given shape and populate it with random samples from a "gamma" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.gamma.html#numpy.random.gamma

Parameters
inShape
inGammaShape
inScaleValue(default 1)
Returns
NdArray

◆ gamma() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::gamma ( dtype  inGammaShape,
dtype  inScaleValue = 1 
)
inline

Single random value sampled from the "gamma" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.gamma.html#numpy.random.gamma

Parameters
inGammaShape
inScaleValue(default 1)
Returns
NdArray

◆ geometric() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::geometric ( const Shape inShape,
double  inP = 0.5 
)
inline

Create an array of the given shape and populate it with random samples from a "geometric" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.geometric.html#numpy.random.geometric

Parameters
inShape
inP(probablity of success [0, 1])
Returns
NdArray

◆ geometric() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::geometric ( double  inP = 0.5)
inline

Single random value sampled from the "geometric" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.geometric.html#numpy.random.geometric

Parameters
inP(probablity of success [0, 1])
Returns
NdArray

◆ laplace() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::laplace ( const Shape inShape,
dtype  inLoc = 0,
dtype  inScale = 1 
)
inline

Create an array of the given shape and populate it with random samples from a "laplace" distrubution. NOTE: Use of this function requires using the Boost includes.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.laplace.html#numpy.random.laplace

Parameters
inShape
inLoc(The position, mu, of the distribution peak. Default is 0)
inScale(float optional the exponential decay. Default is 1)
Returns
NdArray

◆ laplace() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::laplace ( dtype  inLoc = 0,
dtype  inScale = 1 
)
inline

Single random value sampled from the "laplace" distrubution. NOTE: Use of this function requires using the Boost includes.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.laplace.html#numpy.random.laplace

Parameters
inLoc(The position, mu, of the distribution peak. Default is 0)
inScale(float optional the exponential decay. Default is 1)
Returns
NdArray

◆ lognormal() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::lognormal ( const Shape inShape,
dtype  inMean = 0,
dtype  inSigma = 1 
)
inline

Create an array of the given shape and populate it with random samples from a "lognormal" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.lognormal.html#numpy.random.lognormal

Parameters
inShape
inMeanMean value of the underlying normal distribution. Default is 0.
inSigmaStandard deviation of the underlying normal distribution. Should be greater than zero. Default is 1.
Returns
NdArray

◆ lognormal() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::lognormal ( dtype  inMean = 0,
dtype  inSigma = 1 
)
inline

Single random value sampled from the "lognormal" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.lognormal.html#numpy.random.lognormal

Parameters
inMeanMean value of the underlying normal distribution. Default is 0.
inSigmaStandard deviation of the underlying normal distribution. Should be greater than zero. Default is 1.
Returns
NdArray

◆ negativeBinomial() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::negativeBinomial ( const Shape inShape,
dtype  inN,
double  inP = 0.5 
)
inline

Create an array of the given shape and populate it with random samples from the "negative Binomial" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.negative_binomial.html#numpy.random.negative_binomial

Parameters
inShape
inNnumber of trials
inPprobablity of success [0, 1]
Returns
NdArray

◆ negativeBinomial() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::negativeBinomial ( dtype  inN,
double  inP = 0.5 
)
inline

Single random value sampled from the "negative Binomial" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.negative_binomial.html#numpy.random.negative_binomial

Parameters
inNnumber of trials
inPprobablity of success [0, 1]
Returns
NdArray

◆ nonCentralChiSquared() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::nonCentralChiSquared ( const Shape inShape,
dtype  inK = 1,
dtype  inLambda = 1 
)
inline

Create an array of the given shape and populate it with random samples from a "non central chi squared" distrubution. NOTE: Use of this function requires using the Boost includes.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.noncentral_chisquare.html#numpy.random.noncentral_chisquare

Parameters
inShape
inK(default 1)
inLambda(default 1)
Returns
NdArray

◆ nonCentralChiSquared() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::nonCentralChiSquared ( dtype  inK = 1,
dtype  inLambda = 1 
)
inline

Single random value sampled from the "non central chi squared" distrubution. NOTE: Use of this function requires using the Boost includes.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.noncentral_chisquare.html#numpy.random.noncentral_chisquare

Parameters
inK(default 1)
inLambda(default 1)
Returns
NdArray

◆ normal() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::normal ( const Shape inShape,
dtype  inMean = 0,
dtype  inSigma = 1 
)
inline

Create an array of the given shape and populate it with random samples from a "normal" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.normal.html#numpy.random.normal

Parameters
inShape
inMeanMean value of the underlying normal distribution. Default is 0.
inSigmaStandard deviation of the underlying normal distribution. Should be greater than zero. Default is 1.
Returns
NdArray

◆ normal() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::normal ( dtype  inMean = 0,
dtype  inSigma = 1 
)
inline

Single random value sampled from the "normal" distrubution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.normal.html#numpy.random.normal

Parameters
inMeanMean value of the underlying normal distribution. Default is 0.
inSigmaStandard deviation of the underlying normal distribution. Should be greater than zero. Default is 1.
Returns
NdArray

◆ permutation() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::permutation ( const NdArray< dtype > &  inArray)
inline

Randomly permute a sequence, or return a permuted range. If x is an integer, randomly permute np.arange(x). If x is an array, make a copy and shuffle the elements randomly.

Parameters
inArray
Returns
NdArray

◆ permutation() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::permutation ( dtype  inValue)
inline

Randomly permute a sequence, or return a permuted range. If x is an integer, randomly permute np.arange(x). If x is an array, make a copy and shuffle the elements randomly.

Parameters
inValue
Returns
NdArray

◆ poisson() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::poisson ( const Shape inShape,
double  inMean = 1 
)
inline

Create an array of the given shape and populate it with random samples from the "poisson" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.poisson.html#numpy.random.poisson

Parameters
inShape
inMean(default 1)
Returns
NdArray

◆ poisson() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::poisson ( double  inMean = 1)
inline

Single random value sampled from the "poisson" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.poisson.html#numpy.random.poisson

Parameters
inMean(default 1)
Returns
NdArray

◆ rand() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::rand ( )
inline

Single random value sampled from the uniform distribution over [0, 1).

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.rand.html#numpy.random.rand

Returns
NdArray

◆ rand() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::rand ( const Shape inShape)
inline

Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1).

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.rand.html#numpy.random.rand

Parameters
inShape
Returns
NdArray

◆ randFloat() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::randFloat ( const Shape inShape,
dtype  inLow,
dtype  inHigh = 0. 
)
inline

Return random floats from low (inclusive) to high (exclusive), with the given shape. If no high value is input then the range will go from [0, low).

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.ranf.html#numpy.random.ranf

Parameters
inShape
inLow
inHighdefault 0.
Returns
NdArray

◆ randFloat() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::randFloat ( dtype  inLow,
dtype  inHigh = 0. 
)
inline

Return a single random float from low (inclusive) to high (exclusive), with the given shape. If no high value is input then the range will go from [0, low).

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.ranf.html#numpy.random.ranf

Parameters
inLow
inHighdefault 0.
Returns
NdArray

◆ randInt() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::randInt ( const Shape inShape,
dtype  inLow,
dtype  inHigh = 0 
)
inline

Return random integers from low (inclusive) to high (exclusive), with the given shape. If no high value is input then the range will go from [0, low).

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randint.html#numpy.random.randint

Parameters
inShape
inLow
inHighdefault 0.
Returns
NdArray

◆ randInt() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::randInt ( dtype  inLow,
dtype  inHigh = 0 
)
inline

Return random integer from low (inclusive) to high (exclusive), with the given shape. If no high value is input then the range will go from [0, low).

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randint.html#numpy.random.randint

Parameters
inLow
inHighdefault 0.
Returns
NdArray

◆ randN() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::randN ( )
inline

Returns a single random value sampled from the "standard normal" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randn.html#numpy.random.randn

Returns
dtype

◆ randN() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::randN ( const Shape inShape)
inline

Create an array of the given shape and populate it with random samples from the "standard normal" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randn.html#numpy.random.randn

Parameters
inShape
Returns
NdArray

◆ seed()

template<typename GeneratorType = std::mt19937_64>
void nc::random::RNG< GeneratorType >::seed ( int  value)
inlinenoexcept

Seed Constructor

Parameters
valuethe seed value

◆ shuffle()

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
void nc::random::RNG< GeneratorType >::shuffle ( NdArray< dtype > &  inArray)
inline

Modify a sequence in-place by shuffling its contents.

Parameters
inArray

◆ standardNormal() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::standardNormal ( )
inline

Single random value sampled from the "standard normal" distrubution with mean = 0 and std = 1

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.standard_normal.html#numpy.random.standard_normal

Returns
NdArray

◆ standardNormal() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::standardNormal ( const Shape inShape)
inline

Create an array of the given shape and populate it with random samples from a "standard normal" distrubution with mean = 0 and std = 1

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.standard_normal.html#numpy.random.standard_normal

Parameters
inShape
Returns
NdArray

◆ studentT() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::studentT ( const Shape inShape,
dtype  inDof 
)
inline

Create an array of the given shape and populate it with random samples from the "student-T" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.standard_t.html#numpy.random.standard_t

Parameters
inShape
inDofindependent random variables
Returns
NdArray

◆ studentT() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::studentT ( dtype  inDof)
inline

Single random value sampled from the "student-T" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.standard_t.html#numpy.random.standard_t

Parameters
inDofindependent random variables
Returns
NdArray

◆ triangle() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::triangle ( const Shape inShape,
dtype  inA = 0,
dtype  inB = 0.5,
dtype  inC = 1 
)
inline

Create an array of the given shape and populate it with random samples from the "triangle" distribution. NOTE: Use of this function requires using the Boost includes.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.triangular.html#numpy.random.triangular

Parameters
inShape
inA
inB
inC
Returns
NdArray

◆ triangle() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::triangle ( dtype  inA = 0,
dtype  inB = 0.5,
dtype  inC = 1 
)
inline

Single random value sampled from the "triangle" distribution. NOTE: Use of this function requires using the Boost includes.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.triangular.html#numpy.random.triangular

Parameters
inA
inB
inC
Returns
NdArray

◆ uniform() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::uniform ( const Shape inShape,
dtype  inLow,
dtype  inHigh 
)
inline

Draw samples from a uniform distribution.

Samples are uniformly distributed over the half - open interval[low, high) (includes low, but excludes high)

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.uniform.html#numpy.random.uniform

Parameters
inShape
inLow
inHigh
Returns
NdArray

◆ uniform() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::uniform ( dtype  inLow,
dtype  inHigh 
)
inline

Draw sample from a uniform distribution.

Samples are uniformly distributed over the half - open interval[low, high) (includes low, but excludes high)

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.uniform.html#numpy.random.uniform

Parameters
inLow
inHigh
Returns
NdArray

◆ uniformOnSphere()

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::uniformOnSphere ( uint32  inNumPoints,
uint32  inDims = 2 
)
inline

Such a distribution produces random numbers uniformly distributed on the unit sphere of arbitrary dimension dim. NOTE: Use of this function requires using the Boost includes.

Parameters
inNumPoints
inDimsdimension of the sphere (default 2)
Returns
NdArray

◆ weibull() [1/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
NdArray< dtype > nc::random::RNG< GeneratorType >::weibull ( const Shape inShape,
dtype  inA = 1,
dtype  inB = 1 
)
inline

Create an array of the given shape and populate it with random samples from the "weibull" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.weibull.html#numpy.random.weibull

Parameters
inShape
inA(default 1)
inB(default 1)
Returns
NdArray

◆ weibull() [2/2]

template<typename GeneratorType = std::mt19937_64>
template<typename dtype >
dtype nc::random::RNG< GeneratorType >::weibull ( dtype  inA = 1,
dtype  inB = 1 
)
inline

Single random value sampled from the "weibull" distribution.

NumPy Reference: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.weibull.html#numpy.random.weibull

Parameters
inA(default 1)
inB(default 1)
Returns
NdArray

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