SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
RandomStreamFactory Interface Reference

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...

Inheritance diagram for RandomStreamFactory:
[legend]

Public Member Functions

RandomStream newInstance ()
 Constructs and returns a new random stream. More...
 

Detailed Description

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.

Hence, if several random streams of a given type (class) must be constructed at different places in a large simulation program, and if we decide to change the type of stream in the future, there is no need to change the code at those different places. With the random stream factory, the class-specific code for constructing these streams appears at a single place, where the factory is constructed.

The class BasicRandomStreamFactory provides an implementation of this interface.

Member Function Documentation

◆ newInstance()

RandomStream newInstance ( )

Constructs and returns a new random stream.

If the instantiation of the random stream fails, this method throws a RandomStreamInstantiationException.

Returns
the newly-constructed random stream.
Exceptions
RandomStreamInstantiationExceptionif the new random stream cannot be instantiated.

Implemented in BasicRandomStreamFactory.


The documentation for this interface was generated from the following file: