diff options
| author | jwise <jwise@NetBSD.org> | 2000-11-30 22:06:04 +0000 |
|---|---|---|
| committer | jwise <jwise@NetBSD.org> | 2000-11-30 22:06:04 +0000 |
| commit | 962b76a979befb56046bcf41c361b870ef171b14 (patch) | |
| tree | f672df9f17c54011e28f7d09a3e177705af57190 | |
| parent | 57a75ab7b9a0f4999cae7c0fa5acb46f230f38f2 (diff) | |
| download | bsdgames-darwin-962b76a979befb56046bcf41c361b870ef171b14.tar.gz bsdgames-darwin-962b76a979befb56046bcf41c361b870ef171b14.zip | |
Use random() instead of rand(), and seed from time(3) instead of from getpid().
| -rw-r--r-- | sail/extern.h | 4 | ||||
| -rw-r--r-- | sail/main.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sail/extern.h b/sail/extern.h index 4d247370..be09b24b 100644 --- a/sail/extern.h +++ b/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.16 2000/11/30 22:02:20 jwise Exp $ */ +/* $NetBSD: extern.h,v 1.17 2000/11/30 22:06:04 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -60,7 +60,7 @@ extern char nobells; /* -b, don't ring bell before Signal */ extern gid_t gid; extern gid_t egid; -#define dieroll() ((rand() >> 3) % 6 + 1) +#define dieroll() ((random()) % 6 + 1) #define sqr(a) ((a) * (a)) #define abs(a) ((a) > 0 ? (a) : -(a)) #define min(a,b) ((a) < (b) ? (a) : (b)) diff --git a/sail/main.c b/sail/main.c index 5db425de..e3ea98c1 100644 --- a/sail/main.c +++ b/sail/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.11 2000/11/30 22:02:20 jwise Exp $ */ +/* $NetBSD: main.c,v 1.12 2000/11/30 22:06:04 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: main.c,v 1.11 2000/11/30 22:02:20 jwise Exp $"); +__RCSID("$NetBSD: main.c,v 1.12 2000/11/30 22:06:04 jwise Exp $"); #endif #endif /* not lint */ @@ -71,7 +71,7 @@ main(int argc, char **argv) exit(1); close(fd); - srand(getpid()); + srandom((u_long)time(NULL)); if ((p = strrchr(*argv, '/')) != NULL) p++; |
