diff options
| author | millert <> | 1998-12-07 21:47:22 +0000 |
|---|---|---|
| committer | millert <> | 1998-12-07 21:47:22 +0000 |
| commit | b1f354cb9ac9f0e438b65c8b37d6acf3f66b848e (patch) | |
| tree | 59d21e32ae453d46abce3b56c4ebda504bd70e3b /src/lib/libc/stdlib | |
| parent | 56a9035075f410cfb2c8bb20110d758081756705 (diff) | |
| download | openbsd-b1f354cb9ac9f0e438b65c8b37d6acf3f66b848e.tar.gz openbsd-b1f354cb9ac9f0e438b65c8b37d6acf3f66b848e.tar.bz2 openbsd-b1f354cb9ac9f0e438b65c8b37d6acf3f66b848e.zip | |
No need to cast to they type we already are. Also minor KNF
Diffstat (limited to 'src/lib/libc/stdlib')
| -rw-r--r-- | src/lib/libc/stdlib/rand.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/rand.c b/src/lib/libc/stdlib/rand.c index 838c98a9fd..bb180886c0 100644 --- a/src/lib/libc/stdlib/rand.c +++ b/src/lib/libc/stdlib/rand.c | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
| 35 | static char *rcsid = "$OpenBSD: rand.c,v 1.5 1998/12/07 16:44:41 millert Exp $"; | 35 | static char *rcsid = "$OpenBSD: rand.c,v 1.6 1998/12/07 21:47:22 millert Exp $"; |
| 36 | #endif /* LIBC_SCCS and not lint */ | 36 | #endif /* LIBC_SCCS and not lint */ |
| 37 | 37 | ||
| 38 | #include <sys/types.h> | 38 | #include <sys/types.h> |
| @@ -44,19 +44,22 @@ int | |||
| 44 | rand_r(seed) | 44 | rand_r(seed) |
| 45 | u_int *seed; | 45 | u_int *seed; |
| 46 | { | 46 | { |
| 47 | |||
| 47 | *seed = *seed * 1103515245 + 12345; | 48 | *seed = *seed * 1103515245 + 12345; |
| 48 | return (u_int)(*seed) % ((u_int)RAND_MAX + 1); | 49 | return (*seed % ((u_int)RAND_MAX + 1)); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | int | 52 | int |
| 52 | rand() | 53 | rand() |
| 53 | { | 54 | { |
| 54 | return rand_r(&next); | 55 | |
| 56 | return (rand_r(&next)); | ||
| 55 | } | 57 | } |
| 56 | 58 | ||
| 57 | void | 59 | void |
| 58 | srand(seed) | 60 | srand(seed) |
| 59 | u_int seed; | 61 | u_int seed; |
| 60 | { | 62 | { |
| 63 | |||
| 61 | next = seed; | 64 | next = seed; |
| 62 | } | 65 | } |
