Hello folk
i am a new member n i need Ur help to do my course project for developing Sudoku game
i already have my codes but i need a code for generating random numbers in the grid

this is basically my code

import javax.swing.*;
import java.awt.*;
import java.util.*;
/* < applet code="Generate.class" height=200 width200>
</applet>
*/


public class Generatew  extends JApplet
{
JButton model1[][];

public void init()
{
Container cp= getContentPane();

model1 =new JButton[9][9];

Random  rnd=new Random(1);
int[][] model =new int[9][9];

cp.setLayout(new GridLayout(9,9));



for (int i=0; i<9; i++)
{
  int t=(int) (10*Math.random());
for (int j=0; j<9; j++)
{

  	 int t1=(int) (10*Math.random());
	 
  if ((t==0) || (t==t1))
   model[i][j]=0;
  else
  
model[i][j]=rnd.nextInt(10);

model1[i][j]=new JButton(String.valueOf(model[i][j]));
cp.add(model1[i][j]);


}
 
}

}
}

thank u in advance

need a code for generating random numbers

I see that you are using the Math class's random method and the Random class. Can you explain what your problem is?
Show what the program does and explain why that is not what you want and show what you do want.

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.