The probability density function for an exponentially distributed random variable X, f(x), is:
Because exponential random variates are frequently used to generate random variates with different probability distributions and several algorithms are available to generate an exponential random variate; the place holder, Exponential_Random_Variate(), is used for the exponentially distributed random variate. Any other function which uses an exponential random variate calls Exponential_Random_Variate(), which in turn calls the algorithm to generate an exponential random variate. The function, Init_Exponential_Random_Variate(), must be called prior to calling Exponential_Random_Variate().
- void Init_Exponential_Random_Variate( double (*r_generator)(void) )
This function sets the exponential random number generator to that specified by the argument so that later calls to Exponential_Random_Variate() will call the function given in the argument list. Currently, two such possible functions are given below: Exponential_Variate_Inversion() and Exponential_Variate_Ziggurat().
- double Exponential_Random_Variate( void )
This function calls the exponential generator specified in the call to Init_Exponential_Random_Variate to return an exponential random variate.
- double Exponential_Variate_Inversion( void )
This function uses the inversion method to return a random variate with the exponential density given above.
- double Exponential_Variate_Ziggurat( void )
This function uses the Marsaglia's ziggurat method to return a random variate with the exponential density given above.