MCPcopy Create free account
hub / github.com/PCGen/pcgen / getRandomInt

Method getRandomInt

code/src/java/pcgen/base/util/RandomUtil.java:51–64  ·  view source on GitHub ↗

Get a random integer between 0 (inclusive) and the given value (exclusive). @param high The upper limit (exclusive) to be used to select a random value. @return a Random Integer that is {@literal 0 < x < high}

(int high)

Source from the content-addressed store, hash-verified

49 * @return a Random Integer that is {@literal 0 < x < high}
50 */
51 public static int getRandomInt(int high)
52 {
53 if (high <= 0)
54 {
55 return 0;
56 }
57 int rand = random.nextInt(high);
58 if (Logging.isDebugMode())
59 {
60 Logging.debugPrint("Generated random number between " //$NON-NLS-1$
61 + "0 and " + high + ": " + rand); //$NON-NLS-1$//$NON-NLS-2$
62 }
63 return rand;
64 }
65
66 /**
67 * Set the object used to generate the random numbers

Callers 5

rollHPMethod · 0.95
rollMethod · 0.95
runMethod · 0.95
getRandomValueMethod · 0.95
makeChoiceMethod · 0.95

Calls 2

isDebugModeMethod · 0.95
debugPrintMethod · 0.95

Tested by

no test coverage detected