From 2e0639abc56dcad0ce4b5933604d0c8657ac094b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 28 Apr 2016 06:37:55 -0700 Subject: Only use getpid for rand seed if HAVE_UNISTD_H. * rand.c (make_random_state): Don't use getpid if we aren't on something that looks like Unix. --- rand.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rand.c b/rand.c index 7bdc2a99..6cdd937d 100644 --- a/rand.c +++ b/rand.c @@ -140,7 +140,9 @@ val make_random_state(val seed) val time = time_sec_usec(); r->state[0] = convert(rand32_t, c_num(car(time))); r->state[1] = convert(rand32_t, c_num(cdr(time))); +#if HAVE_UNISTD_H r->state[2] = convert(rand32_t, getpid()); +#endif memset(r->state + 3, 0xAA, sizeof r->state - 3 * sizeof r->state[0]); } else if (random_state_p(seed)) { struct rand_state *rseed = coerce(struct rand_state *, -- cgit v1.2.3