|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.zcu.fav.kiv.jsim.random.JSimDrawStream
public class JSimDrawStream
A stream generating random boolean values. The probability that true is generated is determined by the user when the stream is constructed. An initial seed can be specified, which allows you to generate the same sequence of boolean random values several times.
Field Summary | |
---|---|
private double |
probability
The probability that true will be generated each time getNext() is invoked. |
protected java.util.Random |
stream
An internal stream from which random numbers are taken and modified. |
Constructor Summary | |
---|---|
JSimDrawStream(double probability)
Creates a new stream generating random boolean values. |
|
JSimDrawStream(double probability,
long seed)
Creates a new stream generating random boolean values. |
Method Summary | |
---|---|
boolean |
getNext()
Returns a randomly generated boolean value. |
double |
getProbability()
Returns the probability that true is generated by getNext(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Random stream
private double probability
Constructor Detail |
---|
public JSimDrawStream(double probability) throws JSimInvalidParametersException
probability
- The probability that true will be returned by getNext().
JSimInvalidParametersException
- This exception is thrown out if the given probability is out of the interval <0,1>.public JSimDrawStream(double probability, long seed) throws JSimInvalidParametersException
probability
- The probability that true will be returned by getNext().seed
- A seed that will initialize the generator.
JSimInvalidParametersException
- This exception is thrown out if the given probability is out of the interval <0,1>.Method Detail |
---|
public boolean getNext()
public double getProbability()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |