I need help on using the shuffle, random, or random_shuffle function. I looked at the page on cplusplus, but it just confuses me, a lot. This is kinda linked to my other problem
http://www.cplusplus.com/forum/general/131733/ because i have not yet solved it. Some say to use the random_shuffle (
http://www.cplusplus.com/reference/algorithm/random_shuffle/) so i try using it, but it confuses me too much.
especially this part
|
random_shuffle(people.begin(), people.end(), something);
|
Its saying that there's no member for begin and end, or something like that.
so then I do this
|
random_shuffle(people.begin(0), people.end(number));
|
and then its says expected primary expression before [&int]
number is the number of people there are, that the user inputs.
people[number] is a string array used for storing names of people. I need it to be randomized so it works with my code from my other topic. (
http://www.cplusplus.com/forum/general/131733/)
or, just so that it works by itself, and I'll eventually find a way to incorporate it into my code. Please do not use std::, I always use
1 2 3
|
#include <iostream>
#include <math.h>
using namespace std;
|
before every program. The std:: just confuses me.
Edit: To reply to Peter87's post, do I need any other #include with the random_shuffle function, other than iostream and math.h?