diff options
Diffstat (limited to 'src/lib/libc/stdlib/random.c')
| -rw-r--r-- | src/lib/libc/stdlib/random.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/random.c b/src/lib/libc/stdlib/random.c index 48e892042b..5a9a7c3313 100644 --- a/src/lib/libc/stdlib/random.c +++ b/src/lib/libc/stdlib/random.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: random.c,v 1.15 2005/11/30 07:51:02 otto Exp $ */ | 1 | /* $OpenBSD: random.c,v 1.16 2012/03/21 12:36:49 millert Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 1983 Regents of the University of California. | 3 | * Copyright (c) 1983 Regents of the University of California. |
| 4 | * All rights reserved. | 4 | * All rights reserved. |
| @@ -196,7 +196,8 @@ srandom(unsigned int x) | |||
| 196 | if (rand_type == TYPE_0) | 196 | if (rand_type == TYPE_0) |
| 197 | state[0] = x; | 197 | state[0] = x; |
| 198 | else { | 198 | else { |
| 199 | state[0] = x; | 199 | /* A seed of 0 would result in state[] always being zero. */ |
| 200 | state[0] = x ? x : 1; | ||
| 200 | for (i = 1; i < rand_deg; i++) { | 201 | for (i = 1; i < rand_deg; i++) { |
| 201 | /* | 202 | /* |
| 202 | * Implement the following, without overflowing 31 bits: | 203 | * Implement the following, without overflowing 31 bits: |
