com.newisys.random
Interface PRNGFactory

All Known Implementing Classes:
LinearCongruentialFactory, MersenneTwisterFactory

public interface PRNGFactory

A factory for creating pseudorandom number generators of a particular kind.


Method Summary
 PRNG newInstance()
          Creates a new pseudorandom number generator with an arbitrarily chosen seed.
 PRNG newInstance(long seed)
          Creates a new pseudorandom number generator with the given seed.
 PRNG newInstance(PRNG seedSource)
          Creates a new pseudorandom number generator with a seed generated using the given generator.
 

Method Detail

newInstance

PRNG newInstance()
Creates a new pseudorandom number generator with an arbitrarily chosen seed. Generally, this seed will be a non-constant value, such as the current system time, so this method is not suitable for cases where reproducibility is desired.

Returns:
a new PRNG instance

newInstance

PRNG newInstance(long seed)
Creates a new pseudorandom number generator with the given seed. For a given factory, if two generators are created with the same seed, they will produce the same sequence of values.

Parameters:
seed - the value used to seed the new generator
Returns:
a new PRNG instance

newInstance

PRNG newInstance(PRNG seedSource)
Creates a new pseudorandom number generator with a seed generated using the given generator. This method is useful for creating families of independent random number generators all seeded from the same source.

Parameters:
seedSource - the source of random data used to seed the new generator
Returns:
a new PRNG instance