org.jscience.measure.random
Class RandomShuffle

java.lang.Object
  extended by org.jscience.measure.random.RandomElement
      extended by 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:

Source code is available.


Constructor Summary
RandomShuffle(RandomElement ga, RandomElement gb, int ds)
           
 
Method Summary
 double nextDouble()
          The generator.
 
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
 

Constructor Detail

RandomShuffle

public RandomShuffle(RandomElement ga,
                     RandomElement gb,
                     int ds)
Parameters:
ga - generator to fill shuffle deck
gb - geberator to choose from shuffle deck
ds - the size of the shuffle deck
Method Detail

nextDouble

public double nextDouble()
The generator.

Returns:
a random scalar
See Also:
RandomElement.nextDouble(double[], int)