From 18b46dde5ae4fa5e5301191412f6049279cfb0b5 Mon Sep 17 00:00:00 2001 From: thib Date: Sat, 2 Feb 2002 14:52:29 +0000 Subject: [PATCH] better use of rand(). --- database.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database.c b/database.c index 22f3a04..9ab46fc 100644 --- a/database.c +++ b/database.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: database.c,v 1.60 2002-01-27 16:33:20 thib Exp $ */ + /* $Id: database.c,v 1.61 2002-02-02 14:52:29 thib Exp $ */ #include "fcron.h" @@ -964,8 +964,8 @@ set_next_exe(CL *line, char option) intend_int = mktime(&intend); /* set a random time to add to the first allowed time of execution */ - nextexe += ( (i= intend_int - nextexe) > 0) ? (time_t)( rand() % i) : 0 ; - + nextexe += ( (i= intend_int - nextexe) > 0) ? + (time_t)(((float)i * (float)rand())/(float)RAND_MAX) : 0; } line->cl_nextexe = nextexe + (line->cl_file->cf_tzdiff * 3600); -- 2.40.0