Interface StreamInterface
- All Known Implementing Classes:
DX120Generator,Java2Random,MersenneTwister,RandomNumberGenerator
public interface StreamInterface
The StreamInterface defines the streams to be used within the JSTATS package. Potential implementations include the pseudo
random stream, the fully one-time random stream, etc.
Copyright (c) 2002-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information DSOL Manual. The DSOL project is distributed under a three-clause BSD-style license, which can be found at DSOL License.
- Author:
- Alexander Verbraeck, Peter Jacobs
-
Method Summary
Modifier and TypeMethodDescriptionlongReturn the original seed of the generator with which it has been first initialized.longgetSeed()Return the seed of the generator.booleanReturn the next pseudo-random, uniformly distributed boolean value.doubleReturn a pseudo-random number from the stream over the interval (0,1) using this stream, after advancing its state by one step.floatReturn a pseudo-random number from the stream over the interval (0,1) using this stream, after advancing its state by one step.intnextInt()Return a pseudo-random number from the stream over using this stream, after advancing its state by one step.intnextInt(int i, int j) Return pseudo-random number from the stream between the integers i (inclusive) and j (inclusive).longnextLong()Return a pseudo-random number from the stream over using this stream, after advancing its state by one step.voidreset()Reset the stream to use the original seed with which it was initialized.voidsetSeed(long seed) Set the seed of the generator.
-
Method Details
-
nextBoolean
boolean nextBoolean()Return the next pseudo-random, uniformly distributed boolean value.- Returns:
- a pseudo-random boolean with 50/50 chance for true or false
-
nextDouble
double nextDouble()Return a pseudo-random number from the stream over the interval (0,1) using this stream, after advancing its state by one step.- Returns:
- the pseudo-random number
-
nextFloat
float nextFloat()Return a pseudo-random number from the stream over the interval (0,1) using this stream, after advancing its state by one step.- Returns:
- the pseudo-random number
-
nextInt
int nextInt()Return a pseudo-random number from the stream over using this stream, after advancing its state by one step.- Returns:
- the pseudo-random number
-
nextInt
int nextInt(int i, int j) Return pseudo-random number from the stream between the integers i (inclusive) and j (inclusive).- Parameters:
i- the minimal valuej- the maximum value- Returns:
- a value between i and j
-
nextLong
long nextLong()Return a pseudo-random number from the stream over using this stream, after advancing its state by one step.- Returns:
- the pseudo-random number
-
getSeed
long getSeed()Return the seed of the generator.- Returns:
- the seed
-
getOriginalSeed
long getOriginalSeed()Return the original seed of the generator with which it has been first initialized.- Returns:
- the original seed of the generator when it was first initialized
-
setSeed
void setSeed(long seed) Set the seed of the generator.- Parameters:
seed- the new seed
-
reset
void reset()Reset the stream to use the original seed with which it was initialized.
-