jeudi 6 avril 2017

Random number generator without repeat?

I have tried to program a random number generator that is not repetitive. But I am unable to and can't figure out why. My code is like this at the moment :

public void printNS(){

    System.out.print("Numeros Numeros: ");

    for(int i=0; i < 5 ; i++){
        System.out.print( (int)(Math.random()*50) + ",");
    }

    System.out.print("; Numeros Stars: ");

    for(int i=0; i < 2 ; i++){
        System.out.print( (int)(Math.random()*12)+ ",");    
    }

}




Aucun commentaire:

Enregistrer un commentaire