Also “Algorithm P” in Knuth’s The Art of Computer Programming.

for (auto i = vec.size(); i-- > 0;){
    auto j = random_integer(i); // Random integer from 0 <= j <= i
    std::swap(vec[i], vec[j]);
}