| Total Complexity | 1 |
| Total Lines | 15 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** |
||
| 25 | public class XegerUtils { |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Generates a random number within the given bounds. |
||
| 29 | * |
||
| 30 | * @param min The minimum number (inclusive). |
||
| 31 | * @param max The maximum number (inclusive). |
||
| 32 | * @param random The object used as the randomizer. |
||
| 33 | * @return A random number in the given range. |
||
| 34 | */ |
||
| 35 | 1226 | public final static int getRandomInt(final int min, final int max, final Random random) { |
|
| 36 | 1226 | final int dif = max - min; |
|
| 37 | 1226 | final float number = random.nextFloat(); // 0 <= number < 1 |
|
| 38 | |||
| 39 | 1226 | return min + Math.round(number * dif); |
|
| 40 | } |
||
| 45 |