QESBPCSRandom Unit Types Routines |
Description
This is designed to work in Borland Delphi 6 CLX and above, Borland C++ Builder 6 CLX and above, and Borland Kylix 2 and above. Most if not all features will work in Kylix 1 but it is not currently supported.
Supplies various Random Number Generators based on specified Distributions.
No dependency on the Delphi Math unit - so can be used with Standard Versions of Delphi 4 & 5 that do not include it.
This unit is equivalent to our Freeware package: AMRandom.
============================
Following is from Alan Miller's Original FORTRAN Package:
Distribution Function/subroutine name
Normal (Gaussian) Random_Normal
Gamma Random_Gamma
Chi-squared Random_ChiSq
Exponential Random_Exponential
Weibull Random_Weibull
Beta Random_Beta
t Random_T
Multivariate normal Random_MVNorm
Generalized inverse Gaussian Random_Inv_Gauss
Poisson Random_Poisson
Binomial Random_Binomial1 *
Random_Binomial2 *
Negative binomial Random_neg_Binomial
von Mises Random_von_Mises
Cauchy Random_Cauchy
Two functions are provided for the binomial distribution. If the parameter values remain constant, it is recommended that the first function is used (random_binomial1). If one or both of the parameters change, use the second function (random_binomial2).
Delphi's own random number generator, Random, is used to provide a source of uniformly distributed random numbers.
N.B. At this stage, only one random number is generated at each call to one of the functions above.
Some of the code is adapted from Dagpunar's book:
Dagpunar, J. 'Principles of random variate generation' Clarendon Press, Oxford, 1988. ISBN 0-19-852202-9
Author: Alan Miller
CSIRO Division of Mathematical & Information Sciences
Private Bag 10, Clayton South MDC
Clayton 3169, Victoria, Australia
Phone: (+61) 3 9545-8036 Fax: (+61) 3 9545-8080
e-mail: Alan.Miller @ vic.cmis.csiro.au
============================
Copyright © 1999-2002 ESB Consultancy
v2.3 - 14 September 2002
Types |
TRandomGenFunction | Function type for Uniform Random Number Generator - returns a value 0 <= x <= 1 |
Routines |
DelphiRandom | Used to call Delphi's Inbuilt Random Number Generator. |
Random_Beta | Function generates a Random variate in [0,1] from a Beta Distribution with density proportional to BETA**(AA-1) * (1-BETA)**(BB-1). |
Random_Binomial1 | Function generates a Random Binomial Variate using C D Kemp's method. |
Random_Binomial2 | Generates a single random deviate from a binomial distribution whose number of trials is N and whose probability of an event in each trial is P. |
Random_Cauchy | Generate a random variant from the standard Cauchy distribution. |
Random_ChiSq | Generates a random variate from the Chi-Squared Distribution with given degrees of freedom. |
Random_Exponential | Function generates a Random Variate in [0, Infinity) from a negative exponential distribution with density proportional to EXP (-random_exponential), using Inversion. |
Random_Gamma | Function generates a Random Gamma Variate. |
Random_Inv_Gauss | Function generates a Random Variate in [0, Infinity) from a reparameterised generalised inverse Gaussian (GIG) Distribution with Density proportional to GIG**(H-1) * EXP(-0.5*B*(GIG+1/GIG)) using a ratio method. |
Random_MVNorm | Routine to generate an N-Variate Random Normal Vector using a Cholesky Decomposition. |
Random_Neg_Binomial | Function generates a Random Negative Binomial variate. |
Random_Normal | The function random_normal() returns a normally distributed pseudo-random number with zero mean and unit variance. |
Random_Poisson | Generates a single random deviate from a Poisson distribution with mean mu. |
Random_T | Function generates a random variate from a Student T Distribution using Kinderman and Monahan;s Ratio Method. |
Random_von_Mises | Function generates a Random von Mises Variate. |
Random_Weibull | Generates a random variate from the Weibull distribution with probability density: a a-1 -x f(x) = a.x e |
|