Skip to content

Commit d976879

Browse files
committed
Make the function more awesome
1 parent ddbd004 commit d976879

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

api/src/main/java/parallelmc/parallelutils/util/RandomTools.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ public class RandomTools {
1111
* Calculates a random integer between two integer values
1212
* @param low The first integer
1313
* @param high The second integer
14-
* @return The random integer between low (inclusive) and high (exclusive)
15-
* For example, if low = 3 and high = 6, possible results could be 3, 4, or 5
14+
* @return The random integer between low and high, inclusive
1615
*/
1716
public static int betweenTwoIntegers(int low, int high) {
1817
Random r = new Random();
19-
return r.nextInt(high-low) + low;
18+
return r.nextInt(high - low + 1) + low;
2019
}
2120
}

0 commit comments

Comments
 (0)