ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters
Class RandomStreamUtil

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.RandomStreamUtil

public class RandomStreamUtil
extends Object

Provides utility methods to create and extend arrays of random streams.


Method Summary
static RandomStream[] createRandomStreamArray(RandomStream[] oldArray, int size, RandomStreamFactory rsf)
          Creates or extends an array of random streams.
static RandomStream[][] createRandomStreamMatrix(RandomStream[][] oldMatrix, int rows, int columns, RandomStreamFactory rsf)
          Creates or extends a matrix (i.e., 2D array) of random streams.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createRandomStreamArray

public static RandomStream[] createRandomStreamArray(RandomStream[] oldArray,
                                                     int size,
                                                     RandomStreamFactory rsf)
Creates or extends an array of random streams. This can be useful when reconstructing a contact center with new parameters, to keep as many random streams as possible for maximizing random number synchronization.

If oldArray is null, a new array of length size will be allocated and filled with random streams. If oldArray is not null and its length is greater than or equal to size, it is returned unchanged. Otherwise, a new array is created, the already constructed random streams are copied and new ones are constructed to fill the array. The random streams are created using the given random stream factory. The method returns an array of random streams with length greater than or equal to size.

Parameters:
oldArray - the old array of random streams.
size - the minimal size of the returned array.
rsf - the random stream factory used to create the random streams.
Returns:
the constructed array of random streams.

createRandomStreamMatrix

public static RandomStream[][] createRandomStreamMatrix(RandomStream[][] oldMatrix,
                                                        int rows,
                                                        int columns,
                                                        RandomStreamFactory rsf)
Creates or extends a matrix (i.e., 2D array) of random streams. This can be useful when reconstructing a contact center with new parameters, to keep as many random streams as possible for maximizing random number synchronization.

If oldMatrix is null, a new array of length rows will be allocated and filled with arrays of random streams. If oldMatrix is not null and its length is greater than or equal to rows, it is returned unchanged. Otherwise, a new array is created, the already constructed arrays of random streams are copied and new ones are constructed to fill the array. The internal arrays of random streams are created using createRandomStreamArray(RandomStream[],int,RandomStreamFactory).

Parameters:
oldMatrix - the old matrix of random streams.
rows - the required number of rows.
columns - the required number of columns.
rsf - the random stream factory used to create streams.
Returns:
the new matrix of random streams.

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.