mardi 22 novembre 2016

random numbers generated in java

I am generating a set of random numbers using Random class object but the generated set of random numbers are all differnt i.e, none of them have the same value. I have run the program many times but everytime the random values generated are same. i.e. none of them is same.

Random rn = new Random(i);
        for (j = 0; j < size; j++)
        {
            int k = rn.nextInt(364);
            digits.add(k);
        }




Aucun commentaire:

Enregistrer un commentaire