std::listdoes not provide random access to its elements that are required std::shuffle(). This is the signature std::shuffle()in its specification (paragraph 25.3.12 of the C ++ standard):
template<class RandomAccessIterator, class UniformRandomNumberGenerator>
void shuffle(RandomAccessIterator first,
RandomAccessIterator last,
UniformRandomNumberGenerator&& g);
If you can, consider using std::vectorinstead, which, by the way, you are advised to use as the default default container with the C ++ standard itself.
( Coliru):
int main()
{
std::default_random_engine generator(10);
std::vector<int> v(10);
std::iota(begin(v), end(v), 0);
std::shuffle(begin(v), end(v), generator);
for (auto x : v) { std::cout << x; }
}
std::iota() - std::generate.