mercredi 22 février 2017

I want to generate different random numbers

I want to generate different random numbers. After, I am going to use drawText command. Finally, I will print to screen.

 int[] sayi=new int[16];
    Random rnd=new Random();
    for(int k=0;k<16;k++){
        sayi[k]=rnd.nextInt(15)+1;

// I am adding if command this spot. But I don't true result.

    }

    int u=0;

    for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            x1=2*x+j*2*x;
            y1=3*y+i*2*y;
            x2=x+x1;
            y2=y+y1;

            Rect alan =new Rect(x1,y1,x2,y2);
            canvas.drawRect(alan,rectangleTus);
            canvas.drawText(String.valueOf(sayi[u]),x1+15,y1+40,rakamlar);
            u++;
        }

I will print numbers from 1 to 16. But, All of the numbers will be different.




Aucun commentaire:

Enregistrer un commentaire