You need to pass pointers to a[0]
and a[10]
, not the elements themselves:
random_shuffle(&a[0], &a[10]); // end must be 10, not 9
In C++11, you can use std::begin
and std::end
:
random_shuffle(std::begin(a), std::end(a));
You need to pass pointers to a[0]
and a[10]
, not the elements themselves:
random_shuffle(&a[0], &a[10]); // end must be 10, not 9
In C++11, you can use std::begin
and std::end
:
random_shuffle(std::begin(a), std::end(a));