org.jscience.measure.random
Class RandomShuffle
java.lang.Object
org.jscience.measure.random.RandomElement
org.jscience.measure.random.RandomShuffle
- All Implemented Interfaces:
- java.lang.Cloneable, RandomGenerator
public class RandomShuffle
- extends RandomElement
RandomShuffle uses one random number generator to shuffle the numbers
produced by another to obliterate sequential correlations.
To initialize a RandomShuffle, pass it two RandomElements. The
first RandomElement is used to generate a table of random numbers
and the second is used to choose one from the table. An example of
usage is,
RandomElement markov=new RandomShuffle(new Ranecu(),new Ranmar(),32)
which would generate a deck of 32 numbers from RANECU and
use RANMAR to choose from the deck.
References:
- F. James; Comp. Phys. Comm. 60 (1990) p 329-344
- D. Knuth; The Art of Computer Programming vol. 2, sec 3.2.2
Source code is available.
| Methods inherited from class org.jscience.measure.random.RandomElement |
choose, choose, clone, coin, coin, gaussian, gaussian, nextDouble, nextDouble, powlaw, uniform |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RandomShuffle
public RandomShuffle(RandomElement ga,
RandomElement gb,
int ds)
- Parameters:
ga - generator to fill shuffle deckgb - geberator to choose from shuffle deckds - the size of the shuffle deck
nextDouble
public double nextDouble()
- The generator.
- Returns:
- a random scalar
- See Also:
RandomElement.nextDouble(double[], int)