nl.tudelft.simulation.jstats.streams
Class Java2Random

java.lang.Object
  extended by java.util.Random
      extended by nl.tudelft.simulation.jstats.streams.Java2Random
All Implemented Interfaces:
Serializable, StreamInterface

public class Java2Random
extends Random
implements StreamInterface

The Java2Random is an extention of the java.util.Random class which implements the StreamInterface.

(c) copyright 2004 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Since:
1.0
Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:25:41 $
Author:
Peter Jacobs
See Also:
Serialized Form

Field Summary
protected  long seed
          seed is a link to the seed value.
 
Constructor Summary
Java2Random()
          creates a new Java2Random and in initializes with System.currentTimeMillis constructs a new Java2Random
Java2Random(long seed)
           
 
Method Summary
 long getSeed()
          returns the seed of the generator
 int nextInt(int i, int j)
          Method returns (pseudo)random number from the stream over the integers i and j .
 void reset()
          resets a stream
 void setSeed(long seed)
          sets the seed of the generator
 
Methods inherited from class java.util.Random
next, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.tudelft.simulation.jstats.streams.StreamInterface
nextBoolean, nextDouble, nextFloat, nextInt, nextLong
 

Field Detail

seed

protected long seed
seed is a link to the seed value. The reason to store the seed in this variable is that there is no getSeed() on the Java2Random

Constructor Detail

Java2Random

public Java2Random()
creates a new Java2Random and in initializes with System.currentTimeMillis constructs a new Java2Random


Java2Random

public Java2Random(long seed)
See Also:
Random.Random(long)
Method Detail

reset

public void reset()
resets a stream

Specified by:
reset in interface StreamInterface
See Also:
StreamInterface.reset()

nextInt

public int nextInt(int i,
                   int j)
Description copied from interface: StreamInterface
Method returns (pseudo)random number from the stream over the integers i and j .

Specified by:
nextInt in interface StreamInterface
Parameters:
i - the minimal value
j - the maximum value
Returns:
int
See Also:
StreamInterface.nextInt(int, int)

setSeed

public void setSeed(long seed)
Description copied from interface: StreamInterface
sets the seed of the generator

Specified by:
setSeed in interface StreamInterface
Overrides:
setSeed in class Random
Parameters:
seed - the new seed
See Also:
Random.setSeed(long)

getSeed

public long getSeed()
Description copied from interface: StreamInterface
returns the seed of the generator

Specified by:
getSeed in interface StreamInterface
Returns:
long the seed
See Also:
StreamInterface.getSeed()


Copyright © 2002-2011 Delft University of Technology, the Netherlands. All Rights Reserved.