jeudi 6 août 2015

Inquiry about random shuffle

I asked a question about this yesterday, but the topic was put on hold because of miscommunication. So I was trying to run a program to shuffle elements in a vector. This portion is completed with the following code:

srand(static_cast<unsigned int>(time(0)));
random_shuffle(scores.begin(), scores.end());

I accept that the code runs without error and that other machines see a random shuffle, but when I run this code the values clearly do not shuffle. This is part of a larger program and when others run the program, the values are clearly shuffled, but when I try running the program over and over again, the values do not shuffle. I'm wondering, possibly naively, if this is because I'm running it on a MacBook, or possibly I don't have my files and folders organized properly. Does anyone have any ideas?




Aucun commentaire:

Enregistrer un commentaire