|
|
|
|
||
|
DEFINITION MODULE RandGen1; (******************************************************************* Module RandGen1 (Version 2.0) Copyright (c) 1990-2006 by Thomas Nemecek and ETH Zurich. Purpose Provides different random number generators. Remarks Former module name was RandGens. Programming o Design Thomas Nemecek 20/07/1990 o Implementation Thomas Nemecek 20/07/1990 ETH Zurich Systems Ecology CHN E 35.1 Universitaetstrasse 16 8092 Zurich SWITZERLAND URLs: <mailto:RAMSES@env.ethz.ch> <http://www.sysecol.ethz.ch> <http://www.sysecol.ethz.ch/SimSoftware/RAMSES> Last revision of definition: 09/05/1996 FT *******************************************************************) PROCEDURE Weibull(): REAL; PROCEDURE WeibullP(alpha, beta: REAL): REAL; (* Provides Weibull distributed random variables. The 2-parametric Weibull distribution is used. Prbability density function: f(x) = alpha * beta^-alpha * x^(alpha-1) * Exp(-(x/beta)^alpha) For Weibull the parameters have to be defined by procedure SetWeibullPars (s.b.). Defaults are: alpha = 1.0 beta = 1.0 *) PROCEDURE SetWeibullPars( alpha, beta: REAL); PROCEDURE GetWeibullPars(VAR alpha, beta: REAL); (* Setting and retrieval of the parameters alpha and beta used by the random number generator Weibull. *) PROCEDURE Triang(): REAL; PROCEDURE TriangP(min, mode, max: REAL): REAL; (* Provides random numbers following a triangular distribution with the parameters min,mode,max, where min = lowest value max = highest value mode = coordinate of maximum. For Triang the parameters have to be defined by procedure SetTriangPars (s.b.). Defaults are: min = -1.0 max = 1.0 mode = 0.0 *) PROCEDURE SetTriangPars( min, mode, max: REAL); PROCEDURE GetTriangPars(VAR min, mode, max: REAL); (* Setting and retrieval of the parameters min, max and mode used by the random number generator Triang. *) PROCEDURE VM(): REAL; PROCEDURE VMP(mean, kappa: REAL): REAL; (* provides random number from the von Mises distribution (called also the circular normal distribution). The values are in the interval [0, 2π] For VM the parameters have to be defined by procedure SetVMPars (s.b.). Defaults are: mean = 0.0 kappa = 1.0 *) PROCEDURE SetVMPars( mean, kappa: REAL); PROCEDURE GetVMPars(VAR mean, kappa: REAL); (* Setting and retrieval of the parameters mean and kappa used by the random number generator VM. *) TYPE URandGen = PROCEDURE(): REAL; (* NOTE: ALWAYS call one of the following two procedures before calling any other random number generator from this module: *) PROCEDURE InstallU0(u0: URandGen); (* Allows to install the basic random number generator needed by all generators exported by this module. The random number generator u0 must sample uniformly distributes variates within interval [0..1), i.e. it may generate 0.0, but must not generate exactly 1. For instance you may install procedure U from module RandGen contained in the auxiliary library of the RAMSES software, which satisfies these specifications and produces high quality pseudo-random number sequences (See also procedure InstallU1). *) PROCEDURE InstallU1(u1: URandGen); (* Allows to install the basic random number generator needed by all generators exported by this module. The random number generator u1 must sample uniformly distributes variates within interval (0..1] or (0..1), i.e. it may or may not generate 1.0, but must not generate exactly 0. The installation of a good generator u1 satisfying these specifications results in more efficient variates sampling by the NegExp generator than when installing a basic generator via procedure InstallU0. However, the efficiency may be in conflict with the quality of the generated pseudo-random number sequences (see also procedure InstallU0). *) END RandGen1.
|
||
|
|
|