Browse Source

No need to cast to they type we already are. Also minor KNF

OPENBSD_2_5
millert 26 years ago
parent
commit
9fe2fbfc57
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      src/lib/libc/stdlib/rand.c

+ 6
- 3
src/lib/libc/stdlib/rand.c View File

@ -32,7 +32,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #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 */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -44,19 +44,22 @@ int
rand_r(seed) rand_r(seed)
u_int *seed; u_int *seed;
{ {
*seed = *seed * 1103515245 + 12345; *seed = *seed * 1103515245 + 12345;
return (u_int)(*seed) % ((u_int)RAND_MAX + 1);
return (*seed % ((u_int)RAND_MAX + 1));
} }
int int
rand() rand()
{ {
return rand_r(&next);
return (rand_r(&next));
} }
void void
srand(seed) srand(seed)
u_int seed; u_int seed;
{ {
next = seed; next = seed;
} }

Loading…
Cancel
Save