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)
| 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 |
no test coverage detected