From 7d7d6944ed7bfda61b00d6c4463531ff5b92199b Mon Sep 17 00:00:00 2001 From: tls Date: Tue, 7 Jan 1997 12:24:57 +0000 Subject: Sync to 4.4BSD-Lite2 --- random/random.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'random') 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 +#include #include #include @@ -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) -- cgit v1.2.3