Created
January 23, 2023 02:11
-
-
Save Muku784/b15dbad1b80a4227239b40c9e6a72c51 to your computer and use it in GitHub Desktop.
Lotto 4 digits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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