-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP24.java
More file actions
33 lines (28 loc) · 837 Bytes
/
P24.java
File metadata and controls
33 lines (28 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package lists;
import java.util.List;
import static lists.P22.range;
/**
* Lotto: Draw N different random numbers from the set 1..M.
* The selected numbers shall be put into a result list.
* Example:
* ?- lotto(6,49,L).
* L = [23,1,17,33,21,37]
*/
public final class P24 {
private P24() {
}
/**
* Random select from interval.
*
* @param count count of random items
* @param min minimal number of interval
* @param max maximum number from interval
* @return list of integers
*/
public static List<Integer> randomSelect(final int count,
final int min,
final int max) {
List<Integer> integerList = range(min, max);
return P23.randomSelect(integerList, count);
}
}