mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-02-07 23:59:36 +08:00
fix broken random device on mingw
This commit is contained in:
parent
a1dae3b22e
commit
d85bb78139
@ -158,7 +158,11 @@ struct my_random_t
|
|||||||
|
|
||||||
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=gen_tmp;
|
||||||
gen.discard(700000); //magic
|
gen.discard(700000); //magic
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user