PCL
pcl::RandomNumberGenerator Class Reference

Mersenne Twister (MT19937) pseudo-random number generator. More...

#include <Random.h>

Public Member Functions

 RandomNumberGenerator (double ymax=1.0, uint32 seed=0)
 
virtual ~RandomNumberGenerator ()
 
double Gaussian (double mean=0, double sigma=1)
 
double Normal (double mean=0, double sigma=1)
 
double operator() ()
 
int Poisson (double lambda)
 
double Rand1 ()
 
uint32 Rand32 ()
 
void SetUpperBound (double ymax)
 
double Uniform ()
 
double UpperBound () const
 

Detailed Description

Deprecated:
This class has been deprecated. Use the XoShiRo256ss and XoRoShiRo1024ss classes for all newly produced code.

Generation of pseudo-random numbers with user-selectable range and probability distributions.

This generator supports the uniform, normal (Gaussian) and Poisson distributions. In addition, the upper range of generated uniform deviates can be arbitrarily defined.

RandomNumberGenerator is a functional class. The function call operator()() returns pseudo-random numbers in the range [0,ymax], where ymax is the user-defined arbitrary upper range.

Example of use:

RandomNumberGenerator R, R1( 10 ); // R's ymax = 1, R1's ymax = 10
// ...
double y = R(); // y = random uniform deviate in the range [0,1]
double z = R1(); // z = random uniform deviate in the range [0,10]

References

Based on an adaptation of SIMD-oriented Fast Mersenne Twister (SFMT) by Mutsuo Saito and Makoto Matsumoto (Hiroshima University).

Currently PCL implements a SFMT generator with a period of 2^19937-1.

SFMT Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima University. All rights reserved.

Definition at line 154 of file Random.h.

Constructor & Destructor Documentation

◆ RandomNumberGenerator()

pcl::RandomNumberGenerator::RandomNumberGenerator ( double  ymax = 1.0,
uint32  seed = 0 
)

Constructs a RandomNumberGenerator object.

Parameters
ymaxUpper bound of uniform deviates. The function call operator double operator()() and the Uniform() member function (which are synonyms) will return uniform pseudo-random deviates in the range [0,ymax]. The default value is 1.0.
seed32-bit initialization seed. If this parameter is zero, a unique random seed will be generated automatically. The default value is zero.

◆ ~RandomNumberGenerator()

virtual pcl::RandomNumberGenerator::~RandomNumberGenerator ( )
virtual

Virtual destructor.

Member Function Documentation

◆ Gaussian()

double pcl::RandomNumberGenerator::Gaussian ( double  mean = 0,
double  sigma = 1 
)
inline

Generates a floating point normal deviate with the specified mean and standard deviation sigma.

This is a convenience alias for Normal( mean, sigma ).

Definition at line 222 of file Random.h.

◆ Normal()

double pcl::RandomNumberGenerator::Normal ( double  mean = 0,
double  sigma = 1 
)

Generates a floating point normal deviate with the specified mean and standard deviation sigma.

◆ operator()()

double pcl::RandomNumberGenerator::operator() ( )
inline

Generates a floating point uniform deviate in the range [0,UpperBound()]

Definition at line 181 of file Random.h.

◆ Poisson()

int pcl::RandomNumberGenerator::Poisson ( double  lambda)

Generates a discrete random deviate from a Poisson distribution with the specified expected value lambda.

◆ Rand1()

double pcl::RandomNumberGenerator::Rand1 ( )
inline

Generates a floating point uniform deviate in the range 0,1.

Definition at line 195 of file Random.h.

References uint32_max.

◆ Rand32()

uint32 pcl::RandomNumberGenerator::Rand32 ( )

Generates a 32-bit unsigned integer uniform deviate.

◆ SetUpperBound()

void pcl::RandomNumberGenerator::SetUpperBound ( double  ymax)
inline

Sets the upper bound ymax > 0 for this random number generator.

Definition at line 244 of file Random.h.

References uint32_max.

◆ Uniform()

double pcl::RandomNumberGenerator::Uniform ( )
inline

Generates a floating point uniform deviate in the range [0,UpperBound()]

This is a convenience alias for operator()().

Definition at line 205 of file Random.h.

◆ UpperBound()

double pcl::RandomNumberGenerator::UpperBound ( ) const
inline

Returns the current upper bound of this random number generator.

Definition at line 236 of file Random.h.


The documentation for this class was generated from the following file:
pcl::RandomNumberGenerator::RandomNumberGenerator
RandomNumberGenerator(double ymax=1.0, uint32 seed=0)