spot  0.8.2
Public Member Functions | Protected Attributes
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>

List of all members.

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 Thu Jan 19 2012 19:33:04 for spot by doxygen 1.7.6.1