diff options
Diffstat (limited to 'src/lib/libc/stdlib/srand48.c')
-rw-r--r-- | src/lib/libc/stdlib/srand48.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/srand48.c b/src/lib/libc/stdlib/srand48.c index f76b6cca86..115b9e82aa 100644 --- a/src/lib/libc/stdlib/srand48.c +++ b/src/lib/libc/stdlib/srand48.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: srand48.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ | 1 | /* $OpenBSD: srand48.c,v 1.4 2014/12/08 21:45:20 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1993 Martin Birgmeier | 3 | * Copyright (c) 1993 Martin Birgmeier |
4 | * All rights reserved. | 4 | * All rights reserved. |
@@ -18,9 +18,19 @@ extern unsigned short __rand48_seed[3]; | |||
18 | extern unsigned short __rand48_mult[3]; | 18 | extern unsigned short __rand48_mult[3]; |
19 | extern unsigned short __rand48_add; | 19 | extern unsigned short __rand48_add; |
20 | 20 | ||
21 | int __rand48_deterministic; | ||
22 | |||
21 | void | 23 | void |
22 | srand48(long seed) | 24 | srand48(long seed) |
23 | { | 25 | { |
26 | srand48_deterministic(seed); | ||
27 | __rand48_deterministic = 0; | ||
28 | } | ||
29 | |||
30 | void | ||
31 | srand48_deterministic(long seed) | ||
32 | { | ||
33 | __rand48_deterministic = 1; | ||
24 | __rand48_seed[0] = RAND48_SEED_0; | 34 | __rand48_seed[0] = RAND48_SEED_0; |
25 | __rand48_seed[1] = (unsigned short) seed; | 35 | __rand48_seed[1] = (unsigned short) seed; |
26 | __rand48_seed[2] = (unsigned short) (seed >> 16); | 36 | __rand48_seed[2] = (unsigned short) (seed >> 16); |