You are not seeding all of the internal state.
Something like his would be better for seeding it:
std::array<int, std::mt19937::state_size> seed_data;
std::random_device r;
std::generate_n(seed_data.data(), seed_data.size(), std::ref(r));
std::seed_seq seq(std::begin(seed_data), std::end(seed_data));
std::mt19937 engine(seq);
thanks for mention it, i have done that for a my game but i have experienced performance issue when i try to seed for every call. in this game it okay it is not noticeable.
for generic random engine i have modified
Jesper Juhl suggested to allow user to use either std::mt19937 or std::mt19937_64. by default it is for 32 bit like this:
template<class T = std::mt19937, std::size_t N = T::state_size>
auto ProperlySeededRandomEngine() -> typename std::enable_if_t<!!N, T> {
std::array<typename T::result_type, N> seed_data;
thread_local static std::random_device source;
std::generate(std::begin(seed_data), std::end(seed_data), std::ref(source));
std::seed_seq seeds(std::begin(seed_data), std::end(seed_data));
T seeded_engine(seeds);
return seeded_engine;
}
void utilities::shuffleVector(std::vector<int> &shuffle) {
int i = 0;
std::transform(shuffle.begin(), shuffle.end(), shuffle.begin(), [&i](int j) { return j = i++; });
std::shuffle(shuffle.begin(), shuffle.end(), ProperlySeededRandomEngine());
}