Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- public class Lottos {
- public static int a;
- public static void main(String[] args) {
- int[] lottozahlen = new int[5];
- for (int i = 0; i < lottozahlen.length; i++) {
- do {
- a = myRandom(1, 49);
- lottozahlen[i]= a;
- } while (Arrays.binarySearch(lottozahlen, a) == 1);
- }
- System.out.println(Arrays.toString(lottozahlen));
- }
- public static int myRandom(int low, int high) {
- return (int) (Math.random() * (high - low) + low);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement