ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE RandGen0;

  (*******************************************************************

    Module  RandGen0     (Version 1.0)

      Copyright (c) 1993-2006 by Andreas Fischlin and ETH Zurich.

    Purpose   Simple random number generators often used in
              stochastic simulations.

    Remarks   This module is best used in connection with
              module RandGen.


    Programming

      o Design
        Andreas Fischlin          03/12/1993

      o Implementation
        Andreas Fischlin          03/12/1993


    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:  03/12/1993  AF

  *******************************************************************)


  PROCEDURE J(): INTEGER;
  PROCEDURE Jp(min,max: INTEGER): INTEGER;
  (*
    Return in the range [min..max] uniformly distributed integer
    variates.  For J the range [min..max] has to be defined by
    procedure SetJPar. Default: [min..max] = [0..1].
  *)

  PROCEDURE SetJPar(    min,max: INTEGER);
  PROCEDURE GetJPar(VAR min,max: INTEGER);
  (*
    Setting and retrieval of the range parameters [min..max] used
    by the integer random number generator J.
  *)



  PROCEDURE R(): REAL;
  PROCEDURE Rp(min,max: REAL): REAL;
  (*
    Return in the range [min..max] uniformly distributed real
    variates.  For R the range [min..max] has to be defined by
    procedure SetRPar. Default: [min..max] = [0.0..1.0].
  *)

  PROCEDURE SetRPar(    min,max: REAL);
  PROCEDURE GetRPar(VAR min,max: REAL);
  (*
    Setting and retrieval of the range parameters [min..max] used
    by the real random number generator R.
  *)




  PROCEDURE NegExp(): REAL;
  PROCEDURE NegExpP(lambda: REAL): REAL;
  (*
    Sampling of negative exponentially distributed variates. For
    NegExp the mean lambda has to be defined by procedure
    SetNegExpPar. Default: lambda = 1, i.e. a Poisson process where
    on average occurs 1 event per time unit.
  *)

  PROCEDURE SetNegExpPar(    lambda: REAL);
  PROCEDURE GetNegExpPar(VAR lambda: REAL);
  (*
    Setting and retrieval of the mean parameter lambda used by the
    negative exponential random number generator NegExp.
  *)



  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 RandGen0.


  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]