Skip to content

Instantly share code, notes, and snippets.

@Muku784
Created January 23, 2023 02:11
Show Gist options
  • Save Muku784/b15dbad1b80a4227239b40c9e6a72c51 to your computer and use it in GitHub Desktop.
Save Muku784/b15dbad1b80a4227239b40c9e6a72c51 to your computer and use it in GitHub Desktop.
Lotto 4 digits
// hi rainbows!
import java.util.Random;
public class lotto {
private final int[] array;
public lotto() {
Random rand = new Random();
this.array = new int[4];
for (int i = 0; i < 4; i++) {
array[i] = rand.nextInt(50) + 1;
}
}
public int[] getArray() {
return array;
}
public static void main(String[] args) {
lotto ra = new lotto();
int[] randomArray = ra.getArray();
for (int i : randomArray) {
System.out.println(i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment