diff options
author | Simon Howard | 2006-01-08 17:52:16 +0000 |
---|---|---|
committer | Simon Howard | 2006-01-08 17:52:16 +0000 |
commit | 59aad53bbde97e75e06717ea1b49bd3c92941b83 (patch) | |
tree | f0dd86a71d015dad8e0421869e529e621e19f40c | |
parent | 96495a0ac6e1663ef0a6b137a24f73d46a039e52 (diff) | |
download | chocolate-doom-59aad53bbde97e75e06717ea1b49bd3c92941b83.tar.gz chocolate-doom-59aad53bbde97e75e06717ea1b49bd3c92941b83.tar.bz2 chocolate-doom-59aad53bbde97e75e06717ea1b49bd3c92941b83.zip |
Seed the M_Random random number generator from the system time to give
it some more randomness.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 272
-rw-r--r-- | src/m_random.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/m_random.c b/src/m_random.c index 91dc54e6..a315609f 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: m_random.c 8 2005-07-23 16:44:57Z fraggle $ +// $Id: m_random.c 272 2006-01-08 17:52:16Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard @@ -22,6 +22,10 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.3 2006/01/08 17:52:16 fraggle +// Seed the M_Random random number generator from the system time to give +// it some more randomness. +// // Revision 1.2 2005/07/23 16:44:56 fraggle // Update copyright to GNU GPL // @@ -34,8 +38,11 @@ // //----------------------------------------------------------------------------- -static const char rcsid[] = "$Id: m_random.c 8 2005-07-23 16:44:57Z fraggle $"; +static const char rcsid[] = "$Id: m_random.c 272 2006-01-08 17:52:16Z fraggle $"; + +#include <time.h> +#include "m_random.h" // // M_Random @@ -81,7 +88,11 @@ int M_Random (void) void M_ClearRandom (void) { - rndindex = prndindex = 0; + prndindex = 0; + + // Seed the M_Random counter from the system time + + rndindex = time(NULL) & 0xff; } |