summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormillert <>1998-12-07 21:47:22 +0000
committermillert <>1998-12-07 21:47:22 +0000
commitb1f354cb9ac9f0e438b65c8b37d6acf3f66b848e (patch)
tree59d21e32ae453d46abce3b56c4ebda504bd70e3b /src
parent56a9035075f410cfb2c8bb20110d758081756705 (diff)
downloadopenbsd-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')
-rw-r--r--src/lib/libc/stdlib/rand.c9
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)
35static char *rcsid = "$OpenBSD: rand.c,v 1.5 1998/12/07 16:44:41 millert Exp $"; 35static 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
44rand_r(seed) 44rand_r(seed)
45u_int *seed; 45u_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
51int 52int
52rand() 53rand()
53{ 54{
54 return rand_r(&next); 55
56 return (rand_r(&next));
55} 57}
56 58
57void 59void
58srand(seed) 60srand(seed)
59u_int seed; 61u_int seed;
60{ 62{
63
61 next = seed; 64 next = seed;
62} 65}