Random command



random | altrandom
       / lecuyer forward()      debug
         prn     sloppyperiod   list
         seed1() nosloppyperiod reset
         seed2()

Purpose

Access internal random number generator. Random numbers are obtained (deterministically) by two different linear congruential algorithms, prn and L'Ecuyer, which use one and two seed values, respectively.

Parameters

altrandom
If specified and not an integer number, selects an alternative instance of the internal random number generator. All other parameters given with the command will affect this alternative instance.
forward(fw)
Winds forward the internal random number generator by computing <fw> random numbers.
lecuyer
Switch to a long period 64-bit random generator (L'Ecuyer) which uses two seed values. As of 1808, this is the startup default.
prn
Switch to a short period 32-bit (2**30) random generator which uses the algorithm
seed1 = ( seed1 * 32781 ) % (2**32) 
seed1(s1)
First seed value (for L'Ecuyer) or single seed value (for prn). May be a decimal integer or a hex value (starting with 0x). Note that for prn only odd seeds may be used !
seed2(s2)
Second seed value (for L'Ecuyer). May be a decimal integer or a hex value (starting with 0x).
list
Lists current random generator settings.
sloppyperiod nosloppyperiod
Toggles sloppy or proper handling of random number period overruns.
sloppyperiod disables overrun monitoring. Repeating random sequences might lead to statistically incorrect results. Use it at your own risk.
The startup default is nosloppyperiod.
reset
Reset the specified generator to its startup default
debug
Debug switch. Lots of output !

Remarks

The prn generator has a rather short period, which is easily exhausted for complex simulations, so the L'Ecuyer generator often may be the better choice.
You can query the number of calls to the generator(s) with
   random / list
If this exceeds the expected period of the generator, the simulation results may be questionable.

Examples


  1.    random / seed1(0xB)
    
    Set the first seed value to hexadecimal 'B' (decimal 11)

  2.    random 'alternative' / forward(1073741824)
       random 'alternative' / list
       random / list
    
    Select the alternate random number generator, compute 1073741824 random numbers and list the result.
    The second /list should display the unchanged standard instance of the generator.

Last updated: M.Kraemer,
$Id: traxcmdrandom.html,v 1.7 2019/03/17 22:57:49 kraemer Exp $