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

it supposed to create 5 number per row !!!

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

Member Avatar for hfx642

A BINGO ticket is 2 dimensional.
Why do you have 3 loops?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.