SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
Package umontreal.ssj.rng

Streams of independent uniform random numbers. 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  LFSR113
 Extends RandomStreamBase using a composite linear feedback shift register (LFSR) (or Tausworthe) RNG as defined in [144],. More...
class  LFSR258
 Extends RandomStreamBase using a 64-bit composite linear feedback shift register (LFSR) (or Tausworthe) RNG as defined in [144],. More...
class  MRG31k3p
 Extends the abstract class RandomStreamBase, thus implementing the. 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 [145] , 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  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  TruncatedRandomStream
 Represents a container random stream generating numbers in an interval. More...
class  WELL512
 This class implements the RandomStream interface via inheritance from RandomStreamBase. More...

Detailed Description

Streams of independent uniform random numbers.

This package offers basic facilities for generating multiple streams and substreams of uniform random numbers over the interval \(U(0,1)\) or over a range of integer values. The design is based on the interface RandomStream and the package offers various implementations of this interface, with recurrence-based (sequential) random number generators. 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 [118], [116], [132], [138]. For examples of how to use these streams properly, see [154] and the InventoryCRN.java program in the tutorial examples.

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 are all recommendable. They have been selected to be reasonably fast, to have a reasonably long period, good multivariate uniformity (based on theory), good statistical behavior, and the capacity to implement the interface effectively.
The LFSR113 generator produces sequences of bits that obey a linear recurrence, so they eventually fail statistical tests that measure the linear complexity of these binary sequences. But this can affect only very special types of applications.

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^9\) times to the next substream (jump time). These timings were on a (old) 2100 MHz 32-bit AMD Athlon XP 2800+ computer running Linux, with the JDK 1.4.2.

RNGperiodgen. timejump time
LFSR113\(2^{113}\) 510.08
WELL512\(2^{512}\) 55372
WELL1024\(2^{1024}\) 551450
MT19937\(2^{19937}\) 5660
WELL607\(2^{607}\) 61523
MRG31k3p\(2^{185}\) 661.8
MRG32k3a\(2^{191}\)1092.3

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

RNGperiodgen. timejump time
LFSR113\(2^{113}\) 310.08
WELL512\(2^{512}\) 33234
LFSR258\(2^{258}\) 350.18
MRG31k3p\(2^{185}\) 510.89
MRG32k3a\(2^{191}\) 701.1

Other tools offered in this package are as follows: RandomStreamManager give tools to manage and synchronize several streams simultaneously, BasicRandomStreamFactory permits one to create random stream factories for a given type of stream, and AntitheticStream, BakerTransformedStream, and TruncatedRandomStream permit one to apply automatic transformations to the output of a given stream.

For further details about uniform RNGs, we refer the reader to [108], [151], [153], [154], [155], [140].