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:
parent
4a65843064
commit
26f59954af
1 changed files with 7 additions and 3 deletions
10
ircd/ircd.cc
10
ircd/ircd.cc
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue