diff options
author | pat <> | 2005-03-30 18:51:49 +0000 |
---|---|---|
committer | pat <> | 2005-03-30 18:51:49 +0000 |
commit | 894b6ab0099e7d9ca2ad9acb75246cd0a4542167 (patch) | |
tree | f9fb8e9324f6cbdc10d72cab8b889d470252465a /src/lib/libc/stdlib/rand.c | |
parent | 162f8b042bf31ab94714a6f194e9836c08c085f5 (diff) | |
download | openbsd-894b6ab0099e7d9ca2ad9acb75246cd0a4542167.tar.gz openbsd-894b6ab0099e7d9ca2ad9acb75246cd0a4542167.tar.bz2 openbsd-894b6ab0099e7d9ca2ad9acb75246cd0a4542167.zip |
ansi + de-register
ok otto deraadt
Diffstat (limited to 'src/lib/libc/stdlib/rand.c')
-rw-r--r-- | src/lib/libc/stdlib/rand.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/lib/libc/stdlib/rand.c b/src/lib/libc/stdlib/rand.c index d58d040ad5..6b27ad46d3 100644 --- a/src/lib/libc/stdlib/rand.c +++ b/src/lib/libc/stdlib/rand.c | |||
@@ -28,7 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #if defined(LIBC_SCCS) && !defined(lint) | 30 | #if defined(LIBC_SCCS) && !defined(lint) |
31 | static char *rcsid = "$OpenBSD: rand.c,v 1.7 2003/06/02 20:18:38 millert Exp $"; | 31 | static char *rcsid = "$OpenBSD: rand.c,v 1.8 2005/03/30 18:51:49 pat Exp $"; |
32 | #endif /* LIBC_SCCS and not lint */ | 32 | #endif /* LIBC_SCCS and not lint */ |
33 | 33 | ||
34 | #include <sys/types.h> | 34 | #include <sys/types.h> |
@@ -37,25 +37,20 @@ static char *rcsid = "$OpenBSD: rand.c,v 1.7 2003/06/02 20:18:38 millert Exp $"; | |||
37 | static u_int next = 1; | 37 | static u_int next = 1; |
38 | 38 | ||
39 | int | 39 | int |
40 | rand_r(seed) | 40 | rand_r(u_int *seed) |
41 | u_int *seed; | ||
42 | { | 41 | { |
43 | |||
44 | *seed = *seed * 1103515245 + 12345; | 42 | *seed = *seed * 1103515245 + 12345; |
45 | return (*seed % ((u_int)RAND_MAX + 1)); | 43 | return (*seed % ((u_int)RAND_MAX + 1)); |
46 | } | 44 | } |
47 | 45 | ||
48 | int | 46 | int |
49 | rand() | 47 | rand(void) |
50 | { | 48 | { |
51 | |||
52 | return (rand_r(&next)); | 49 | return (rand_r(&next)); |
53 | } | 50 | } |
54 | 51 | ||
55 | void | 52 | void |
56 | srand(seed) | 53 | srand(u_int seed) |
57 | u_int seed; | ||
58 | { | 54 | { |
59 | |||
60 | next = seed; | 55 | next = seed; |
61 | } | 56 | } |