cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
random_shuffle isn't working
random_shuffle isn't working
Jan 30, 2011 at 2:49am UTC
shadowvillian
(135)
I using random_shuffle from the
#include <algorithm>
library to randomize the elements of a 46 element vector. Buts its always the same. Do I need to seed something and whats the third parameter do in random shuffle?
http://cplusplus.com/reference/algorithm/random_shuffle/
Jan 30, 2011 at 3:35am UTC
Duthomhas
(13206)
You need to seed the random number generator. See lines 6, 7, and 17 of the example.
Jan 30, 2011 at 2:03pm UTC
shadowvillian
(135)
Works perfect thanks!
Topic archived. No new replies allowed.