|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mars_sim.msp.simulation.RandomUtil
public final class RandomUtil
The RandomUtil class is a library of various random-related methods
| Constructor Summary | |
|---|---|
RandomUtil()
|
|
| Method Summary | |
|---|---|
static double |
getRandomDouble(double ceiling)
Returns a random double number from 0 to the ceiling number given. |
static int |
getRandomInt(int ceiling)
Returns a random int number from 0 to (and including) the number given. |
static int |
getRandomInt(int base,
int ceiling)
Returns a random int number from a given base number to (and including) the ceiling number given. |
static int |
getRandomRegressionInteger(int ceiling)
Returns a random integer from 1 to the given integer. |
static double |
getRandomRegressionIntegerAverageValue(int ceiling)
Gets the average value returned from the getRandomRegressionInteger method. |
static java.lang.Object |
getWeightedRandomObject(java.util.Map weightedMap)
Gets a random weighted object from a map. |
static boolean |
lessThanRandPercent(double randomLimit)
Returns true if given number is less than a random percentage. |
static boolean |
lessThanRandPercent(int randomLimit)
Returns true if given number is less than a random percentage. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RandomUtil()
| Method Detail |
|---|
public static boolean lessThanRandPercent(int randomLimit)
randomLimit - the random percentage limit
public static boolean lessThanRandPercent(double randomLimit)
randomLimit - the random percentage limit
public static int getRandomInt(int ceiling)
ceiling - the int limit for the random number
public static int getRandomInt(int base,
int ceiling)
base - the minimum number resultceiling - the maximum number result
public static double getRandomDouble(double ceiling)
ceiling - the maximum number result
public static int getRandomRegressionInteger(int ceiling)
ceiling - the maximum integer result, ( ceiling > 0 )
public static double getRandomRegressionIntegerAverageValue(int ceiling)
ceiling - the maximum integer result, (ceiling > 0)
public static java.lang.Object getWeightedRandomObject(java.util.Map weightedMap)
weightedMap - a map of objects and their weights as Double values.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||