Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

mpcl::util::MRandomNumberGenerator< TItem > Struct Template Reference

Function object to generate random numbers. More...

#include <general-functions.hh>

List of all members.

Public Methods

TItem operator() (const size_t kzMAX) const


Detailed Description

template<typename TItem>
struct mpcl::util::MRandomNumberGenerator< TItem >

Function object to generate random numbers.

Definition at line 332 of file general-functions.hh.


Member Function Documentation

template<typename TItem>
TItem mpcl::util::MRandomNumberGenerator< TItem >::operator() const size_t    kzMAX const [inline]
 

Generates a random number between 0 to kzMAX (inclusive). It uses this formula:

Where:

It takes the higher-order bits of the random number which, usually are more random than the low-order bits. If you want more entropy in the generated random number, you must use std::srand().

Parameters:
kzMAX  Maximum value that it can return (inclusive).
Returns:
A random value from zero to kzMAX.
See also:
std::rand(), std::srand().

Definition at line 352 of file general-functions.hh.


The documentation for this struct was generated from the following file:
Generated on Mon Oct 13 02:35:26 2003 for MPCL by doxygen1.2.18