We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ed9a741 commit 10d5ccbCopy full SHA for 10d5ccb
src/basics2/LearnMath.java
@@ -5,7 +5,9 @@ public static void main(String[] args) {
5
System.out.println(getRandom(10, 20));
6
}
7
8
- public static int getRandom(int a, int b) {
9
- return (int) (Math.random() * (b - a + 1) + a);
+ public static int getRandom(int l, int r) {
+ return l + (int)(Math.random() * (r - l + 1));
10
11
12
+
13
+// Math.random() -> 0.0 ≤ value < 1.0
0 commit comments