Visual Servoing Platform  version 3.2.0 under development (2019-01-22)

#include <visp3/core/vpUniRand.h>

+ Inheritance diagram for vpUniRand:

Public Member Functions

 vpUniRand (const long seed=0)
 
virtual ~vpUniRand ()
 
double operator() ()
 

Protected Member Functions

double draw1 ()
 

Protected Attributes

long x
 

Detailed Description

Class for generating random numbers with uniform probability density.

The algorithms and notations used are described in [14].

The following example shows how to use this class to generate 10 numbers between 0 and 5.

#include <iostream>
#include <visp3/core/vpUniRand.h>
int main()
{
for(unsigned int i=0;i<10;++i)
std::cout << 5*r() << std::endl;
}

Definition at line 65 of file vpUniRand.h.

Constructor & Destructor Documentation

vpUniRand::vpUniRand ( const long  seed = 0)
inlineexplicit

Default constructor.

Definition at line 83 of file vpUniRand.h.

virtual vpUniRand::~vpUniRand ( )
inlinevirtual

Default destructor.

Definition at line 89 of file vpUniRand.h.

Member Function Documentation

double vpUniRand::draw1 ( )
protected

Bays-Durham Shuffling of Park-Miller generator.

Minimal random number generator of Park and Miller with Bays-Durham shuffle. Returns a uniform random deviate between 0.0 and 1.0 (exclusive of the endpoint values).

Definition at line 62 of file vpUniRand.cpp.

References x.

double vpUniRand::operator() ( )
inline

Operator that allows to get a random value.

Definition at line 92 of file vpUniRand.h.

Member Data Documentation

long vpUniRand::x
protected

Definition at line 78 of file vpUniRand.h.

Referenced by draw1().