org.omegahat.Simulation.RandomGenerators
Interface PRNG

All Known Implementing Classes:
CollingsPRNG, NotifyingPRNG

public interface PRNG

Interface to Pseudo-random number generators. This interface provides access to classes that generate uniform random numbers. Values can be obtained either as integers, or as doubles on [0,1).


Method Summary
 double getDoubleEpsilon()
          Return the minimum possible difference between two generated double's.
 int getIntRange()
          Return the largest int value returned by nextInt<\b>.
 PRNGState getState()
          Return an object describing the state of the PRNG.
 double nextDouble()
          Generate a pseudo-random double value from a uniforml distribion on [0,1)
 double[] nextDoubleArray(int n)
          Generate several pseudo-random doubles from a uniforml distribion on [0,1)
 int nextInt()
          Generate a pseudo-random integer from a uniforml distribion on [0,intRange)
 int[] nextIntArray(int n)
          Generate several pseudo-random integers from a uniforml distribion on [0,intRange)
 

Method Detail

nextInt

public int nextInt()
Generate a pseudo-random integer from a uniforml distribion on [0,intRange)

nextIntArray

public int[] nextIntArray(int n)
Generate several pseudo-random integers from a uniforml distribion on [0,intRange)
Parameters:
n - number of integer deviates to return

getIntRange

public int getIntRange()
Return the largest int value returned by nextInt<\b>. This value can be used to convert int's returned by nextInt to doubles uniformly distributed on the range [0,1).

nextDouble

public double nextDouble()
Generate a pseudo-random double value from a uniforml distribion on [0,1)

nextDoubleArray

public double[] nextDoubleArray(int n)
Generate several pseudo-random doubles from a uniforml distribion on [0,1)
Parameters:
n - number of integer deviates to return

getDoubleEpsilon

public double getDoubleEpsilon()
Return the minimum possible difference between two generated double's.

getState

public PRNGState getState()
Return an object describing the state of the PRNG. This state can be used to create another PRNG that has will generate the same stream of random numbers. This can be useful for reproducing simulation results.