Dependents
this module uses 1 subunits
Mersenne
Interface
#include <codecogs/statistics/distributions/continuous/beta/randomsample.h >
using namespace Stats::Dists::Continuous::Beta ;
class Beta_BB Cheng's BB algorithm for generating Beta distribution random values
void init (double alpha, double beta)double generate (Stats::Random::Mersenne* method)double m_a double m_alpha double m_gamma bool m_swap
class Beta_BC Cheng's BC algorithm for generating Beta distribution random values
void init (double alpha, double beta)double generate (Stats::Random::Mersenne* method)double m_k1 double m_alpha double m_a bool m_swap
class RandomSample Generates random deviates from the Beta distribution.
[constructor] RandomSample (double alpha=1, double beta=1, double seed = 0.63245)Constructor to initialise the class
double genReal ()[inline] Generate the next random number
double genReal (double alpha, double beta)Generate next random number with new values for alpha and beta
void init (double alpha, double beta)Reconfigures the random generate with new values of alpha and beta
Beta_BB m_methodBB Beta_BC m_methodBC bool m_method
double sample (double alpha, double beta, double seed=0)Returns a new random number from a beta distribution with alpha and beta
Use the following HTML code to embed the calculators within other websites:
Class RandomSample This class uses the other two classes that live inside this module to create
random values from the Beta distribution. Cheng's algorithm is used.
Source Code Source code is available when you buy a Commercial licence.
Not a member, then Register with CodeCogs . Already a Member, then Login .
Members of RandomSample RandomSample alpha Default Value = 1 beta Default Value = 1 seed Default value = 0.63245
Sample This function is a simple wrapper around the randomsample class provided in this module. It uses a static to keep a single instance of this class, so that each call to this function returns a new random number. As a result this function is not necessarily thread safe, in the sense that with identical initial seed, the sequence of random numbers may differ on a multitasking or multi threaded system.
The seed is only set on the first call to this function. Thereafter this parameter is ignored. If you do no want to set the seed, then we suggest you use the system clock the first time you call this function, i.e.
#include <time.h>
...
sample ( alpha, beta, time ( 0 ) / MERSENNEDIV) ;
If you require more advance behaviour, we strongly recommend that directly use the underlying class randomsample that is provided with this module.
Parameters alpha first shape parameter for the beta distribution beta second shape parameter for the beta distribution seed sets the initial seed for the random generator. Only used in the first call to this function
Source Code Source code is available when you buy a Commercial licence.
Not a member, then Register with CodeCogs . Already a Member, then Login .