spot  1.0.2
Public Member Functions | Protected Attributes | List of all members
spot::barand< gen > Class Template Reference

Compute pseudo-random integer value between 0 and n included, following a binomial distribution for probability p. More...

#include <misc/random.hh>

Collaboration diagram for spot::barand< gen >:
Collaboration graph

Public Member Functions

 barand (int n, double p)
int rand () const

Protected Attributes

const int n_
const double m_
const double s_

Detailed Description

template<double(*)() gen>
class spot::barand< gen >

Compute pseudo-random integer value between 0 and n included, following a binomial distribution for probability p.

gen must be a random function computing a pseudo-random double value following a standard normal distribution. Use nrand() or bmrand().

Usually approximating a binomial distribution using a normal distribution and is accurate only if n*p and n*(1-p) are greater than 5.

Constructor & Destructor Documentation

template<double(*)() gen>
spot::barand< gen >::barand ( int  n,
double  p 
)
inline

Member Function Documentation

template<double(*)() gen>
int spot::barand< gen >::rand ( ) const
inline

Member Data Documentation

template<double(*)() gen>
const double spot::barand< gen >::m_
protected
template<double(*)() gen>
const int spot::barand< gen >::n_
protected
template<double(*)() gen>
const double spot::barand< gen >::s_
protected

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

Please comment this page and report errors about it on the RefDocComments page.
Generated on Wed Mar 6 2013 09:25:15 for spot by doxygen 1.8.1.2