Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWTRandBinomial<Generator>


RWTRandBinomial<Generator>RWTRand<Generator>

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/rand.h>
RWTRandBinomial<Generator> gen;

Descripton

Class RWTRandBinomial<Generator> generates random numbers from a binomial distribution:

where n is the number of trials, and p is the probability of success. The algorithm used to generate the random numbers begins with random numbers generated from a uniform distribution on the interval [0, 1]. Thus, the speed and statistical properties of the binomial random number generator may be changed by varying the Generator template parameter responsible for generating the uniformly distributed numbers.

The class Generator must be a function object whose function call operator returns a uniform random double between 0 and 1. The class RWRandGenerator supplied with the library may be used.

Example

Public Constructors

RWTRandBinomial(unsigned n = 1, double p = 0.5);
RWTRandBinomial(const Generator& g, unsigned n=1, 
double p=.5);
RWTRandBinomial(const RWTRandBinomial<Generator>& g);

Public Operator

double    operator()()

Public Member Functions

double
n() const;
double
p() const;
void
setN(unsigned n);
void
setP(double p);


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.