0
import java.util.Scanner;
import java.util.Random;

public class test 
{

	public static void main(String[] args)
	{
		Random rand= new Random(); // being able to use random object
	
		int[][] array = new int[3][9];
		 // print array in rectangular form
		 for (int i=0; i<array.length; i++) 
		 {
		     for (int j=0; j<array[i].length; j++) 
		     {
		    	 int k = rand.nextInt(9);
		    	 for(int x=0;x<5;x++)
		    	 {
		    		 array[i][k] = j*10 +rand.nextInt(10); 
		    	 }
		    	 
		    	 System.out.print("\t" + array[i][k]);
		     }
		     System.out.println("");
		 }
	
	}
}

i need to create a bingo ticket.
it's supposed to create max 5 number per column but it is creating numbers for all the arrays.

i'm supposed to have a ticket like this

0 11 20 0 47 56 0 72 0
9 0 20 32 41 0 0 74 0
0 18 0 0 44 57 65 0 88

thx in advance

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by hfx642
0

Check the logic that controls how many numbers are printed on a row/line?
Print 5 and then print a newline

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.