I have an array of ints;
int bar [5] = { 10, 20, 30 };
Lets say instead of 3 integers, I have 10,000 in my array.
How would I unsort so that there is no order?
I have an array of ints;
int bar [5] = { 10, 20, 30 };
Lets say instead of 3 integers, I have 10,000 in my array.
How would I unsort so that there is no order?
Just use std::random_shuffle()
:
std::random_shuffle( std::begin( bar ) , std::end( bar ) );
Note:
Is a good practice to pass your custom random number generator to the algorithm:
std::random_device rd;
std::mt19937 g(rd());
std::random_shuffle( std::begin( bar ) , std::end( bar ) , g );