Skip to content

Commit 0a2b90a

Browse files
authored
All things that the Father hath are mine
All things that the Father hath are mine: therefore said I, that he shall take of mine, and shall shew it unto you. (John 16:15)
1 parent c779205 commit 0a2b90a

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
//All things that the Father hath are mine: therefore said I, that he shall take of mine, and shall shew it unto you. (John 16:15)
3+
4+
package com.javarush.task.task28.task2803;
5+
6+
import java.util.concurrent.ThreadLocalRandom;
7+
8+
/*
9+
ThreadLocalRandom
10+
*/
11+
public class Solution {
12+
public static int getRandomIntegerBetweenNumbers(int from, int to)
13+
{
14+
return ThreadLocalRandom.current().nextInt(from, to);
15+
}
16+
17+
public static double getRandomDouble() {
18+
return ThreadLocalRandom.current().nextDouble(0,1);
19+
}
20+
21+
public static long getRandomLongBetween0AndN(long n) {
22+
return ThreadLocalRandom.current().nextLong(0, n);
23+
}
24+
25+
public static void main(String[] args) {
26+
}
27+
}
28+
29+
/*
30+
ThreadLocalRandom
31+
Класс Solution будет использоваться трэдами.
32+
Реализуй логику всех методов, используйте класс ThreadLocalRandom.
33+
getRandomIntegerBetweenNumbers должен возвращать случайный int между from и to.
34+
getRandomDouble должен возвращать случайный double.
35+
getRandomLongBetween0AndN должен возвращать случайный long между 0 и n.
36+
37+
38+
Требования:
39+
1. В классе Solution должны быть только статические методы.
40+
2. Метод getRandomIntegerBetweenNumbers с помощью ThreadLocalRandom должен возвращать случайный int между from и to.
41+
3. Метод getRandomDouble с помощью ThreadLocalRandom должен возвращать случайный double от 0 до 1.
42+
4. Метод getRandomLongBetween0AndN с помощью ThreadLocalRandom должен возвращать случайный long между 0 и n.
43+
*/

0 commit comments

Comments
 (0)