example used: Lotto 6/49
public class lotto {
public static void main(String[] args) {
int num;
// Generate 6 random numbers that range from 1-49 using Math.random()
for (int x = 0; x < 6; x++) {
num = (int) (Math.floor(Math.random() * 49));
System.out.println(num);
}
}
}
(note: may produce duplicate numbers)
No comments:
Post a Comment