Use more random random generator

Addresses: #4352

This changes the shuffle feature to use the Mersenne twister algorithm
instead of the default in C++. It also restructures to use std::shuffle
as std::random_shuffle is deprecated in C++14.