megamek.common
Class MMRandom.Pool36Random

java.lang.Object
  extended by megamek.common.MMRandom
      extended by megamek.common.MMRandom.SunRandom
          extended by megamek.common.MMRandom.Pool36Random
Enclosing class:
MMRandom

static class MMRandom.Pool36Random
extends MMRandom.SunRandom

Behaves like SunRandom for everything but d6(2) calls. Then, it takes numbers from an array of the 36 possible results of two dice, shuffled.


Nested Class Summary
 
Nested classes/interfaces inherited from class megamek.common.MMRandom
MMRandom.CryptoRandom, MMRandom.Pool36Random, MMRandom.SunRandom
 
Field Summary
(package private)  int index
           
static int NUM_SHUFFLES
           
(package private)  MMShuffle[] pool
           
 
Fields inherited from class megamek.common.MMRandom.SunRandom
random
 
Fields inherited from class megamek.common.MMRandom
R_CRYPTO, R_DEFAULT, R_POOL36, R_SUN
 
Constructor Summary
MMRandom.Pool36Random()
           
 
Method Summary
 Roll d6(int nDice)
          Watches for 2 as nDice and then does its special thing.
(package private)  void initPool()
          Initializes the dice pool with the possible results of two dice.
(package private)  void shufflePool()
          Swaps two of the numbers in the pool NUM_SHUFFLES times.
 
Methods inherited from class megamek.common.MMRandom.SunRandom
randomInt
 
Methods inherited from class megamek.common.MMRandom
d6, generate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUM_SHUFFLES

public static final int NUM_SHUFFLES
See Also:
Constant Field Values

pool

MMShuffle[] pool

index

int index
Constructor Detail

MMRandom.Pool36Random

public MMRandom.Pool36Random()
Method Detail

d6

public Roll d6(int nDice)
Watches for 2 as nDice and then does its special thing.

Overrides:
d6 in class MMRandom
Parameters:
nDice - - the int number of dice to roll. If this value is less than or equal to zero, an IllegalArgumentException will be thrown.
Returns:
a Roll object containing the roll results.

initPool

void initPool()
Initializes the dice pool with the possible results of two dice.


shufflePool

void shufflePool()
Swaps two of the numbers in the pool NUM_SHUFFLES times. Resets the index. Uses the regular RNG to shuffle (OH NO!)