|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.measure.random.RandomElement
org.jscience.measure.random.RandomSynchronized
public abstract class RandomSynchronized
RandomSynchronized is a wrapper class that makes a random number generator safe for multi-threaded operation by serializing access in time. For high-performance applications, it is better for each thread to have it's own random number generator.
Note this class is declared serializable, but serialization won't be successful if it's wrapping a non-serializable generator. Source code is available.
RandomElement,
Serialized Form| Constructor Summary | |
|---|---|
RandomSynchronized(RandomElement rng)
Creates a new RandomSynchronized object. |
|
| Method Summary | |
|---|---|
int |
choose(int lo,
int hi)
Wrapped so generators can override. |
double |
gaussian()
Must be synchronized because state is stored in BMoutput |
double |
nextDouble()
Synchronized the raw() method, which is generally not threadsafe. |
void |
nextDouble(double[] d,
int n)
This method probably isn't threadsafe in implementations, so it's synchronized |
| Methods inherited from class org.jscience.measure.random.RandomElement |
|---|
choose, clone, coin, coin, gaussian, nextDouble, powlaw, uniform |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RandomSynchronized(RandomElement rng)
rng - DOCUMENT ME!| Method Detail |
|---|
public double nextDouble()
nextDouble in interface RandomGeneratorRandomJava
public void nextDouble(double[] d,
int n)
nextDouble in class RandomElementd - array to be filled with doublesn - number of doubles to generate
public int choose(int lo,
int hi)
choose in class RandomElementlo - lower limit of rangehi - upper limit of range
public double gaussian()
gaussian in class RandomElement
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||