Re: [hackers] [sbase][PATCH] libutil/random: better random seed
> - *state = ts.tv_nsec;
> + *state = (intptr_t)&printf ^ time(NULL) ^ (ts.tv_nsec * 0xAC5533CD);
tv_nsec is `long` which is signed. Signed interger overflow is
undefined. You need to cast it to `unsigned long` before multiply:
... ^ ((unsigned long)ts.tv_nsec * 0xAC5533CD)
- NRK
Received on Wed Mar 06 2024 - 08:18:03 CET
This archive was generated by hypermail 2.3.0
: Wed Mar 06 2024 - 08:24:37 CET