On Mon, Mar 4, 2024 at 5:03 PM Elie Le Vaillant <eolie...@disroot.org> wrote:
>
> Thanks NRK
> ---
>  libutil/random.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libutil/random.c b/libutil/random.c
> index 780ba29..6b795a9 100644
> --- a/libutil/random.c
> +++ b/libutil/random.c
> @@ -1,4 +1,5 @@
>  #include <stdint.h>
> +#include <stdio.h>
>  #include <time.h>
>
>  static uint64_t globalstate;
> @@ -66,7 +67,7 @@ rng32_seed_r(uint64_t *state)
>  {
>         struct timespec ts;
>         clock_gettime(CLOCK_REALTIME, &ts);
> -       *state = ts.tv_nsec;
> +       *state = (intptr_t)&printf ^ time(NULL) ^ (ts.tv_nsec * 0xAC5533CD);
>  }
>
>  void
> --
> 2.44.0
>
>

Instead of calling time(NULL), you already have the second of the
epoch in ts.tv_sec.

Reply via email to