SSJ  3.3.1
Stochastic Simulation in Java
Classes
Package umontreal.ssj.rng

Random Number Generators. More...

Classes

class  AntitheticStream
 This container class allows the user to force any RandomStream to return antithetic variates. More...
 
class  BakerTransformedStream
 This container class permits one to apply the baker’s transformation to the output of any RandomStream. More...
 
class  BasicRandomStreamFactory
 Represents a basic random stream factory that can constructs new instances of a given RandomStream implementation via the newInstance method. More...
 
interface  CloneableRandomStream
 CloneableRandomStream extends RandomStream and Cloneable. More...
 
class  F2NL607
 Implements the RandomStream interface by using as a backbone generator the combination of the WELL607 proposed in [199], [198]  (and implemented in WELL607 ) with a nonlinear generator. More...
 
class  F2wPoly
 
class  GenF2w32
 Implements the RandomStream interface via inheritance from RandomStreamBase. More...
 
class  LFSR113
 Extends RandomStreamBase using a composite linear feedback shift register (LFSR) (or Tausworthe) RNG as defined in [147], [229] . More...
 
class  LFSR258
 Extends RandomStreamBase using a 64-bit composite linear feedback shift register (LFSR) (or Tausworthe) RNG as defined in [147], [229] . More...
 
class  MRG31k3p
 Extends the abstract class RandomStreamBase, thus implementing the RandomStream interface indirectly. More...
 
class  MRG32k3a
 Extends the abstract class RandomStreamBase by using as a backbone (or main) generator the combined multiple recursive generator (CMRG) MRG32k3a proposed by L’Ecuyer [148] , implemented in 64-bit floating-point arithmetic. More...
 
class  MRG32k3aL
 The same generator as MRG32k3a, except here it is implemented with type long instead of double. More...
 
class  MT19937
 Implements the RandomStream interface via inheritance from RandomStreamBase. More...
 
class  RandMrg
 USE MRG32k3a INSTEAD of this class. More...
 
class  RandomPermutation
 Provides methods to randomly shuffle arrays or lists using a random stream. More...
 
interface  RandomStream
 This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numbers and convenient tools to move around within and across these streams. More...
 
class  RandomStreamBase
 This class provides a convenient foundation on which RNGs can be built. More...
 
interface  RandomStreamFactory
 Represents a random stream factory capable of constructing instances of a given type of random stream by invoking the newInstance method each time a new random stream is needed, instead of invoking directly the specific constructor of the desired type. More...
 
class  RandomStreamInstantiationException
 This exception is thrown when a random stream factory cannot instantiate a stream on a call to its umontreal.ssj.rng.RandomStreamFactory.newInstance method. More...
 
class  RandomStreamManager
 Manages a list of random streams for more convenient synchronization. More...
 
class  RandomStreamWithCache
 This class represents a random stream whose uniforms are cached for more efficiency when using common random numbers. More...
 
class  RandRijndael
 Implements a RNG using the Rijndael block cipher algorithm (AES) with key and block lengths of 128 bits. More...
 
class  Rijndael_Algorithm
 Rijndael –pronounced Reindaal– is a variable block-size (128-, 192- and 256-bit), variable key-size (128-, 192- and 256-bit) symmetric cipher. More...
 
class  Rijndael_Properties
 This class acts as a central repository for an algorithm specific properties. More...
 
class  TruncatedRandomStream
 Represents a container random stream generating numbers in an interval \((a,b)\) instead of in \((0,1)\), where \(0\le a < b \le1\), by using the contained stream. More...
 
class  WELL1024
 Implements the RandomStream interface via inheritance from RandomStreamBase. More...
 
class  WELL512
 This class implements the RandomStream interface via inheritance from RandomStreamBase. More...
 
class  WELL607
 This class implements the RandomStream interface via inheritance from RandomStreamBase. More...
 
class  WELL607base
 

Detailed Description

Random Number Generators.

This package offers the basic facilities for generating uniform random numbers. It provides an interface called umontreal.ssj.rng.RandomStream and some implementations of that interface. The interface specifies that each stream of random numbers is partitioned into multiple substreams and that methods are available to jump between the substreams, as discussed in [122], [120], [137], [158], [144]. For an example of how to use these streams properly, see InventoryCRN in the set of example programs.

Each implementation uses a specific backbone uniform random number generator (RNG), whose period length is typically partitioned into very long non-overlapping segments to provide the streams and substreams. A stream can generate uniform variates (real numbers) over the interval (0,1), uniform integers over a given range of values \(\{i,…,j\}\), and arrays of these.

The generators provided here have various speeds and period lengths. umontreal.ssj.rng.MRG32k3a is the one that has been most extensively tested, but it is not among the fastest. The umontreal.ssj.rng.LFSR113, umontreal.ssj.rng.GenF2w32, umontreal.ssj.rng.MT19937, and the WELL generators produce sequences of bits that obey a linear recurrence, so they eventually fail statistical tests that measure the linear complexity of these bits sequences. But this can affect only very special types of applications.

We recommend primarily umontreal.ssj.rng.MRG31k3p, umontreal.ssj.rng.MRG32k3a, and umontreal.ssj.rng.LFSR113. Note that all the generators provided currently in SSJ were originally designed for 32-bit computers.

For each base generator, the following tables give the approximate period length (period), the CPU time (in seconds) to generate \(10^9\) \(U(0,1)\) random numbers (gen. time), and the CPU time to jump ahead \(10^6\) times to the next substream (jump time). The following timings were on a 2100 MHz 32-bit AMD Athlon XP 2800+ computer running Linux, with the JDK 1.4.2.

RNG period gen. time jump time
LFSR113 \(2^{113}\)  51 0.08
WELL512 \(2^{512}\)  55 372
WELL1024 \(2^{1024}\)  55 1450
MT19937 \(2^{19937}\)  56 60
WELL607 \(2^{607}\)  61 523
GenF2w32 \(2^{800}\)  62 937
MRG31k3p \(2^{185}\)  66 1.8
MRG32k3a \(2^{191}\) 109 2.3
F2NL607 \(2^{637}\) 125 523
RandRijndael \(2^{130}\) 260 0.9

The following timings are on a 2400 MHz 64-bit AMD Athlon 64 Processor 4000+ computer running Linux, with the JDK 1.5.0.

RNG period gen. time jump time
LFSR113 \(2^{113}\)  31 0.08
WELL607 \(2^{607}\)  33 329
WELL512 \(2^{512}\)  33 234
WELL1024 \(2^{1024}\)  34 917
LFSR258 \(2^{258}\)  35 0.18
MT19937 \(2^{19937}\)  36 46
GenF2w32 \(2^{800}\)  43 556
MRG31k3p \(2^{185}\)  51 0.89
F2NL607 \(2^{637}\)  65 329
MRG32k3a \(2^{191}\)  70 1.1
RandRijndael \(2^{130}\) 127 0.6

Other tools included in this package permit one to manage and synchronize several streams simultaneously ( umontreal.ssj.rng.RandomStreamManager ), to create random stream factories for a given type of stream ( umontreal.ssj.rng.BasicRandomStreamFactory ), and to apply automatic transformations to the output of a given stream ( umontreal.ssj.rng.AntitheticStream and umontreal.ssj.rng.BakerTransformedStream ).

For further details about uniform RNGs, we refer the reader to [112], [150], [154], [157], [158], [159] .