I would like to add some random behaviour to my code. I want to do it with the timestamp value. By this way, I want to shuffle a list with the current timestamp. This is my code:
Random random = new Random(SimClock.getIntTime());
Collections.shuffle(list, random);
Shuffle works correctly if I don't use random var to shuffle the list. However, when I use the code above the output list is always the same (it is never shuffled).
Random value changes every time Collections.shuffle is called (I checked it), so I don't know why my list is not shuffled when I use the randon value. Why is this happening?
Aucun commentaire:
Enregistrer un commentaire