0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-14 00:34:18 +01:00

ircd: Fix seed pun.

This commit is contained in:
Jason Volk 2017-03-13 21:14:40 -07:00
parent 4a65843064
commit 26f59954af

View file

@ -195,13 +195,17 @@ ircd::init_rlimit()
void
ircd::init_random()
{
char seed[4];
union
{
char seed_char[4];
int seed_int;
};
std::ifstream s("/dev/urandom");
if(s.good())
s.read(seed, sizeof(seed));
s.read(seed_char, sizeof(seed_char));
srand(reinterpret_cast<const int &>(seed));
srand(seed_int);
}