MIRA
Public Types | Public Member Functions | List of all members
UniformRandomGenerator< T > Class Template Reference

A random generator that samples random numbers within the interval that is passed to the constructor. More...

#include <math/UniformRandomGenerator.h>

Inheritance diagram for UniformRandomGenerator< T >:
Inheritance graph
[legend]

Public Types

typedef detail::UniformRandomDistributionChooser< T >::type ::result_type result_type
 

Public Member Functions

 UniformRandomGenerator (T vmin=T(0), T vmax=T(1))
 
void setLimits (T vmin, T vmax)
 Resets the limits of the uniform distribution to the specified limits. More...
 
result_type operator() ()
 Draws a sample from the random distribution. More...
 
void seed ()
 Seeds the random generator using the current system time. More...
 
void seed (uint32 value)
 Seeds the random generator with the given seed. More...
 
detail::UniformRandomDistributionChooser< T >::type * operator-> ()
 Provides direct access to the underlying random distribution. More...
 
const detail::UniformRandomDistributionChooser< T >::type * operator-> () const
 Provides direct access to the underlying random distribution. More...
 
detail::UniformRandomDistributionChooser< T >::type & distribution ()
 Provides direct access to the underlying random distribution. More...
 
const detail::UniformRandomDistributionChooser< T >::type & distribution () const
 Provides direct access to the underlying random distribution. More...
 
boost::mt19937 & engine ()
 Provides direct access to the underlying random generator engine. More...
 
const boost::mt19937 & engine () const
 Provides direct access to the underlying random generator engine. More...
 

Detailed Description

template<typename T>
class mira::UniformRandomGenerator< T >

A random generator that samples random numbers within the interval that is passed to the constructor.

For integer types, the sampled values are within the interval [vmin,vmax]. For floating point types, the sampled values are within the interval [vmin,vmax).

Example:

// create uniform random number generator for numbers between [1.0f,2.0f)
UniformRandomGenerator<float> rnd(1.0f,2.0f);
// draw a sample:
float sample = rnd();

Member Typedef Documentation

◆ result_type

typedef detail::UniformRandomDistributionChooser< T >::type ::result_type result_type
inherited

Constructor & Destructor Documentation

◆ UniformRandomGenerator()

UniformRandomGenerator ( vmin = T(0),
vmax = T(1) 
)
inlineexplicit

Member Function Documentation

◆ setLimits()

void setLimits ( vmin,
vmax 
)
inline

Resets the limits of the uniform distribution to the specified limits.

◆ operator()()

result_type operator() ( )
inlineinherited

Draws a sample from the random distribution.

◆ seed() [1/2]

void seed ( )
inlineinherited

Seeds the random generator using the current system time.

Hence, after calling this method, the random generator will generate different sequences of random numbers each time.

◆ seed() [2/2]

void seed ( uint32  value)
inlineinherited

Seeds the random generator with the given seed.

The random generator will produce the same sequence of random numbers if the same seed is used.

◆ operator->() [1/2]

detail::UniformRandomDistributionChooser< T >::type * operator-> ( )
inlineinherited

Provides direct access to the underlying random distribution.

◆ operator->() [2/2]

const detail::UniformRandomDistributionChooser< T >::type * operator-> ( ) const
inlineinherited

Provides direct access to the underlying random distribution.

◆ distribution() [1/2]

detail::UniformRandomDistributionChooser< T >::type & distribution ( )
inlineinherited

Provides direct access to the underlying random distribution.

◆ distribution() [2/2]

const detail::UniformRandomDistributionChooser< T >::type & distribution ( ) const
inlineinherited

Provides direct access to the underlying random distribution.

◆ engine() [1/2]

boost::mt19937 & engine ( )
inlineinherited

Provides direct access to the underlying random generator engine.

◆ engine() [2/2]

const boost::mt19937 & engine ( ) const
inlineinherited

Provides direct access to the underlying random generator engine.


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