diff options
author | tls <tls@NetBSD.org> | 1997-01-07 12:24:57 +0000 |
---|---|---|
committer | tls <tls@NetBSD.org> | 1997-01-07 12:24:57 +0000 |
commit | 7d7d6944ed7bfda61b00d6c4463531ff5b92199b (patch) | |
tree | 367c6e6e3e56e8beab9a04899ce404a4f348c892 /random | |
parent | 1ba319c5714af32ed91f3c11e1bdd1440cc90b8a (diff) | |
download | bsdgames-darwin-7d7d6944ed7bfda61b00d6c4463531ff5b92199b.tar.gz bsdgames-darwin-7d7d6944ed7bfda61b00d6c4463531ff5b92199b.tar.zst bsdgames-darwin-7d7d6944ed7bfda61b00d6c4463531ff5b92199b.zip |
Sync to 4.4BSD-Lite2
Diffstat (limited to 'random')
-rw-r--r-- | random/random.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/random/random.c b/random/random.c index 96267e25..f48ecbbb 100644 --- a/random/random.c +++ b/random/random.c @@ -1,4 +1,4 @@ -/* $NetBSD: random.c,v 1.3 1995/04/22 07:44:05 cgd Exp $ */ +/* $NetBSD: random.c,v 1.4 1997/01/07 12:30:26 tls Exp $ */ /* * Copyright (c) 1994 @@ -44,13 +44,14 @@ static char copyright[] = #ifndef lint #if 0 -static char sccsid[] = "@(#)random.c 8.5 (Berkeley) 4/5/94"; +static char sccsid[] = "@(#)random.c 8.6 (Berkeley) 6/1/94"; #else -static char rcsid[] = "$NetBSD: random.c,v 1.3 1995/04/22 07:44:05 cgd Exp $"; +static char rcsid[] = "$NetBSD: random.c,v 1.4 1997/01/07 12:30:26 tls Exp $"; #endif #endif /* not lint */ #include <sys/types.h> +#include <sys/time.h> #include <err.h> #include <errno.h> @@ -68,7 +69,7 @@ main(argc, argv) char *argv[]; { extern int optind; - time_t now; + struct timeval tp; double denom; int ch, random_exit, selected, unbuffer_output; char *ep; @@ -108,8 +109,8 @@ main(argc, argv) /* NOTREACHED */ } - (void)time(&now); - srandom((u_int)(now + getpid())); + (void)gettimeofday(&tp, NULL); + srandom((u_int)(tp.tv_usec + tp.tv_sec + getpid())); /* Compute a random exit status between 0 and denom - 1. */ if (random_exit) |