summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-08-23 21:51:19 +0000
committerUlrich Drepper <drepper@redhat.com>1997-08-23 21:51:19 +0000
commit944599f7c3fc2e867452a39ce0e3ae01159c477d (patch)
tree99a61b61462fdb89ad548603d37fe33891f800f0
parenta0fcfbc60894bfd533491c4043e8129ddbf6c94e (diff)
(__srandom_r): Don't use seed 0. Use 1 in this case.
-rw-r--r--stdlib/random_r.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/stdlib/random_r.c b/stdlib/random_r.c
index 58f5153936..6355097a93 100644
--- a/stdlib/random_r.c
+++ b/stdlib/random_r.c
@@ -127,7 +127,8 @@ __srandom_r (x, buf)
if (buf == NULL || buf->rand_type < TYPE_0 || buf->rand_type > TYPE_4)
return -1;
- buf->state[0] = x;
+ /* We must make sure the seed is not 0. Take arbitrarily 1 in this case. */
+ buf->state[0] = x ? x : 1;
if (buf->rand_type != TYPE_0)
{
long int i;