edu.cornell.lassp.houle.RngPack
Class RandomShuffle
java.lang.Object
cern.colt.PersistentObject
edu.cornell.lassp.houle.RngPack.RandomElement
edu.cornell.lassp.houle.RngPack.RandomShuffle
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
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.
- Version:
- 1.0
- Author:
- Paul Houle (E-mail: houle@msc.cornell.edu)
- See Also:
- Serialized Form
|
Method Summary |
java.lang.Object |
clone()
Returns a copy of the receiver. |
double |
raw()
The generator. |
| Methods inherited from class java.lang.Object |
equals, 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
clone
public java.lang.Object clone()
- Returns a copy of the receiver.
- Overrides:
clone in class PersistentObject
- Returns:
- a copy of the receiver.
raw
public double raw()
- The generator.
- Specified by:
raw in class RandomElement
- Returns:
- a random double in the range (0,1).
- See Also:
RandomElement.raw()