YARP
Yet Another Robot Platform
yarp::math::RandnScalar Class Reference

A random number generator, normal distribution. More...

#include <yarp/math/RandnScalar.h>

Public Member Functions

 RandnScalar ()
 Constructor. More...
 
 ~RandnScalar ()
 
 RandnScalar (int seed)
 Constructor, initialize the generator. More...
 
void init ()
 Initialize the generator. More...
 
void init (int seed)
 Initialize the generator. More...
 
long getSeed ()
 
double get (double u=0.0, double sigma=1.0)
 Generate a randomly generated number, drawn from a normal distribution. More...
 

Detailed Description

A random number generator, normal distribution.

Uses the RandScalar class and the Box-Muller algorithm.

Definition at line 26 of file RandnScalar.h.

Constructor & Destructor Documentation

◆ RandnScalar() [1/2]

RandnScalar::RandnScalar ( )

Constructor.

Definition at line 25 of file RandnScalar.cpp.

◆ ~RandnScalar()

RandnScalar::~RandnScalar ( )

Definition at line 37 of file RandnScalar.cpp.

◆ RandnScalar() [2/2]

RandnScalar::RandnScalar ( int  seed)

Constructor, initialize the generator.

Parameters
seed,seedfor the rnd generator.

Definition at line 31 of file RandnScalar.cpp.

Member Function Documentation

◆ get()

double RandnScalar::get ( double  u = 0.0,
double  sigma = 1.0 
)

Generate a randomly generated number, drawn from a normal distribution.

Parameters
umean of the distribution, default 0.0
sigmasigma of the distribution, default 1.0
Returns
the random number.

Definition at line 58 of file RandnScalar.cpp.

◆ getSeed()

long yarp::math::RandnScalar::getSeed ( )
inline

Definition at line 68 of file RandnScalar.h.

◆ init() [1/2]

void RandnScalar::init ( )

Initialize the generator.

Uses current time for the seed.

Definition at line 43 of file RandnScalar.cpp.

◆ init() [2/2]

void RandnScalar::init ( int  seed)

Initialize the generator.

Provide a seed.

Parameters
seedthe seed

Definition at line 50 of file RandnScalar.cpp.


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