fix broken random device on mingw

This commit is contained in:
U-DESKTOP-T772REH\wangyu 2018-06-19 00:48:09 +08:00
parent a1dae3b22e
commit d85bb78139

View File

@ -158,7 +158,11 @@ struct my_random_t
my_random_t()
{
std::mt19937 gen_tmp(rd());
//std::mt19937 gen_tmp(rd()); //random device is broken on mingw
timespec tmp_time;
clock_gettime(CLOCK_MONOTONIC, &tmp_time);
long long a=((u64_t)tmp_time.tv_sec)*1000000000llu+((u64_t)tmp_time.tv_nsec);
std::mt19937 gen_tmp(a);
gen=gen_tmp;
gen.discard(700000); //magic
}