29 #ifndef LSST_AFW_MATH_RANDOM_H 30 #define LSST_AFW_MATH_RANDOM_H 34 #include "gsl/gsl_rng.h" 255 double flat(
double const a,
double const b);
271 double chisq(
double const nu);
278 double poisson(
double const mu);
287 static char const *
const _algorithmEnvVarName;
288 static char const *
const _seedEnvVarName;
314 template <
typename ImageT>
323 template <
typename ImageT>
333 template <
typename ImageT>
344 template <
typename ImageT>
353 template <
typename ImageT>
363 template <
typename ImageT>
373 template <
typename ImageT>
379 #endif // LSST_AFW_MATH_RANDOM_H static std::vector< std::string > const & getAlgorithmNames()
void randomUniformImage(ImageT *image, Random &rand)
Set image to random numbers uniformly distributed in the range [0, 1)
double poisson(double const mu)
Returns a random variate from the poisson distribution with mean mu.
std::string State
Accessors for the opaque state of the random number generator.
Random(Algorithm algorithm=MT19937, unsigned long seed=1)
Creates a random number generator that uses the given algorithm to produce random numbers...
Random & operator=(Random const &)=default
Algorithm getAlgorithm() const
std::string getAlgorithmName() const
Double precision (48-bit) output using the RANLXS algorithm, luxury level 2 (strongest).
unsigned long uniformInt(unsigned long n)
Returns a uniformly distributed random integer from 0 to n-1.
void randomFlatImage(ImageT *image, Random &rand, double const a, double const b)
Set image to random numbers uniformly distributed in the range [a, b)
Second-generation version of the RANLUX algorithm of Lüscher, 24-bit output, luxury level 0 (weakest)...
Fifth-order multiple recursive generator by L'Ecuyer, Blouin, and Coutre.
void randomUniformPosImage(ImageT *image, Random &rand)
Set image to random numbers uniformly distributed in the range (0, 1)
Number of supported algorithms.
void setState(State const &state)
Accessors for the opaque state of the random number generator.
A base class for image defects.
Original version of the RANLUX algorithm, 24-bit output (all bits are decorrelated).
void randomChisqImage(ImageT *image, Random &rand, double const nu)
Set image to random numbers with a chi^2_{nu} distribution.
void randomGaussianImage(ImageT *image, Random &rand)
Set image to random numbers with a gaussian N(0, 1) distribution.
double chisq(double const nu)
Returns a random variate from the chi-squared distribution with nu degrees of freedom.
double flat(double const a, double const b)
Returns a random variate from the flat (uniform) distribution on [a, b).
unsigned long getSeed() const
double gaussian()
Returns a gaussian random variate with mean 0 and standard deviation 1
double uniformPos()
Returns a uniformly distributed random double precision floating point number from the generator...
Random deepCopy() const
Creates a deep copy of this random number generator.
Algorithm
Identifiers for the list of supported algorithms.
Second-generation version of the RANLUX algorithm of Lüscher, 24-bit output, luxury level 1 (stronger...
std::size_t getStateSize() const
Accessors for the opaque state of the random number generator.
Combined multiple recursive generator by L'Ecuyer.
State getState() const
Accessors for the opaque state of the random number generator.
void randomUniformIntImage(ImageT *image, Random &rand, unsigned long n)
Set image to random integers uniformly distributed in the range 0 ...
void randomPoissonImage(ImageT *image, Random &rand, double const mu)
Set image to random numbers with a Poisson distribution with mean mu (n.b.
A fifth-order multiple recursive generator by L'Ecuyer, Blouin, and Coutre.
Original version of the RANLUX algorithm, 24-bit output.
A maximally equidistributed combined Tausworthe generator by L'Ecuyer with improved seeding relative ...
Second-generation version of the RANLUX algorithm of Lüscher, 24-bit output, luxury level 2 (stronges...
double uniform()
Returns a uniformly distributed random double precision floating point number from the generator...
A class that can be used to generate sequences of random numbers according to a number of different a...
A maximally equidistributed combined Tausworthe generator by L'Ecuyer.
The MT19937 "Mersenne Twister" generator of Makoto Matsumoto and Takuji Nishimura.
Double precision (48-bit) output using the RANLXS algorithm, luxury level 1 (weakest).