Skip to content

Commit e3bcbcd

Browse files
committed
fix Random.randomInt not returning the maximum value
1 parent 7cf7ea2 commit e3bcbcd

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ index: 4
44
lang: en
55
---
66

7+
## 4.15.2
8+
9+
- 🐛 Fix: Random.randomInt not return the maximum value.
10+
711
## 4.15.1
812

913
- 🐛 Fix: Edge detection not working correctly.

Diff for: resources/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ author.url=https://openpatch.org
4040
# This is NOT a direct link to where to download it.
4141

4242
library.url=https://github.com/openpatch/scratch-for-java
43-
library.version=4.15.1
43+
library.version=4.15.2
4444

4545

4646
# Set the category (or categories) of your Library from the following list:

Diff for: src/org/openpatch/scratch/extensions/math/Random.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public static double random() {
132132
* @return a random integer
133133
*/
134134
public static int randomInt(int max) {
135-
return getRandom().nextInt(max);
135+
return getRandom().nextInt(max + 1);
136136
}
137137

138138
/**
@@ -153,6 +153,7 @@ public static double random(double max) {
153153
* @return a random integer
154154
*/
155155
public static int randomInt(int min, int max) {
156+
max += 1;
156157
return getRandom().nextInt(max - min) + min;
157158
}
158159

0 commit comments

Comments
 (0)