[cvs] SF.net SVN: bogofilter:[6912] trunk/bogofilter/src/rand_sleep.c
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <m-...@us...> - 2010-07-05 15:17:37
|
Revision: 6912 http://bogofilter.svn.sourceforge.net/bogofilter/?rev=6912&view=rev Author: m-a Date: 2010-07-05 15:17:31 +0000 (Mon, 05 Jul 2010) Log Message: ----------- Use stronger PRNG. Modified Paths: -------------- trunk/bogofilter/src/rand_sleep.c Modified: trunk/bogofilter/src/rand_sleep.c =================================================================== --- trunk/bogofilter/src/rand_sleep.c 2010-07-05 14:17:51 UTC (rev 6911) +++ trunk/bogofilter/src/rand_sleep.c 2010-07-05 15:17:31 UTC (rev 6912) @@ -14,8 +14,8 @@ struct timeval timeval; need_init = false; gettimeofday(&timeval, NULL); - srand((uint)timeval.tv_usec); /* RATS: ignore - this is safe enough */ + srand48(timeval.tv_usec ^ timeval.tv_sec); } - delay = (int)(min + ((max-min)*rand()/(RAND_MAX+1.0))); + delay = (int)(min + ((max-min)*drand48())); bf_sleep(delay); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |