codice:
String Num = "";
	String Num2 = "";
			
	for (int j = 0; j < NColonne; j++)
  	{
		int kk = 0;
		while (kk != NColonne)
   		{
     		int rand = (int) (Math.random()*NColonne)+1;
     		for (int a = 0; a < NColonne; a++)
     		{
					Num = numero[a].getText();
					Num2 = Integer.toString (rand);	
					
					if (!(Num.equals(Num2))) 
					{
	  					kk++;
					}
						else if (Num.equals(Num2))
					{
	  					kk--;
					}
     		}
				numero[j].setText (Integer.ToString(Num2));
				System.out.println(Num2);
		}
	}
Appunto io faccio così! solo il controllo non è corretto