diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-12-07 21:47:23 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-12-07 21:47:23 +0000 |
commit | 7a6fc9a98ee7c648672a6dbbe4074caf725062be (patch) | |
tree | 765b355fb87c06846e5d6267ead6a284d8cf302a /lib | |
parent | eacd154234055a90e4f5c09d0b5f75bc1f730275 (diff) |
No need to cast to they type we already are. Also minor KNF
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdlib/rand.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c index 838c98a9fd0..bb180886c01 100644 --- a/lib/libc/stdlib/rand.c +++ b/lib/libc/stdlib/rand.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: rand.c,v 1.5 1998/12/07 16:44:41 millert Exp $"; +static char *rcsid = "$OpenBSD: rand.c,v 1.6 1998/12/07 21:47:22 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -44,19 +44,22 @@ int rand_r(seed) u_int *seed; { + *seed = *seed * 1103515245 + 12345; - return (u_int)(*seed) % ((u_int)RAND_MAX + 1); + return (*seed % ((u_int)RAND_MAX + 1)); } int rand() { - return rand_r(&next); + + return (rand_r(&next)); } void srand(seed) u_int seed; { + next = seed; } |