Hi everyone,
My goal is to generate lottery numbers that have 6 unique numbers in the range of 1-49
ex. if the user inputs 2 as the number of tickets they want, the program should print out
1 2 3 4 5 6
10 9 8 7 12 11

---2 rows and 6 colums

so far this is my code. I am very new at java, i understand what has to be done but it's the writing it that is getting me confused, any help is very much welcomed.

public static void main(String[] args) {
		// Create Scanner
		Scanner number = new Scanner(System.in);

		// prompt the user to number of tickets
		System.out.println("Please indicate how many tickets you want to generate?");
		int num = number.nextInt();
		System.out.println(num );
	}

	public static int[][] generateLottoTickets(int num) {
		
		//generate the ticket numbers starting from 1 (only 6 at a time)
		//return them into a two dimensial array with a ticket per row.		
	
	}
	
	public static boolean isCoveringAllBases(int[][]tickets){
		// check whether the tickets passed as 2-d array
		
		//if it does print or does not print it out still

}
}

As a random generator use Class java.util.Random. Method nextInt(...
details in docs

java.util.Random r;
    int give_me_number_0_49() {
        return r.nextInt(49);
    }

i used this

//generate lottery numbers
		int rand=(int)(Math.Random*49);
		rand++;//count only from 1-49

however, i am still having problems with the whole code

Hi have this, but i still need help plz

public static int[][] getnerateLottoTickets(int num) {


//generate 6 random lottery numbers and assign them to a 2-day array
int [][] random=new int[6][6];//generate 6 random numbers

for(int i=0; i < random.length; i++);

for (int j=0; j<random.length; j++);

//number between 1-49
random[i][j] =(int)(Math.random()*49);
}
//return the array and print
return random;

}
public static boolean isCoveringAllBases(int[][]tickets){
// check whether the tickets passed as 2-d array


//if it does print or does not print it out still
system.out.println(i, j)
}
}
}
{

Edited 7 Years Ago by starlight09: error in code

This question has already been answered. Start a new discussion instead.