Hi there I'm trying to make a lottery, generating 6 random numbers adding them to an array and then getting a users numbers and adding them to an array. This is what I've tried so far.
Heres my lottery class,
class Lottery {
Random rand = new Random();
// generating lottery numbers
int cpnum;
int[] allCpNumbers = new int[100];
// bets placed
int betsPlaced;
}
Here's my for loop to generate the random numbers and add them into my array
// printing lottery numbers
for(int i = 0; i <= 6; i++) {
lottery.cpnum = rand.nextInt(50) + 1;
lottery.allCpNumbers[i] = lottery.cpnum;
}
When printing the random numbers it gives me this
System.out.println(lottery.allCpNumbers);
Output:
[I@1b6d3586
I want it to be a set of 6 random numbers arranged like 3,13,10,43,12 etc.