diff options
author | gepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-01-17 18:06:34 +0000 |
---|---|---|
committer | gepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-01-17 18:06:34 +0000 |
commit | 95548cb1caad95933e2b36df9a13af070b733b04 (patch) | |
tree | b9ce67cc8b45c6956528e5bb2935900b6d8ad441 /src/common | |
parent | a09cc2371ac0a2534f514a35a5637614c11f6a37 (diff) | |
download | hercules-95548cb1caad95933e2b36df9a13af070b733b04.tar.gz hercules-95548cb1caad95933e2b36df9a13af070b733b04.tar.bz2 hercules-95548cb1caad95933e2b36df9a13af070b733b04.tar.xz hercules-95548cb1caad95933e2b36df9a13af070b733b04.zip |
Enabled Mersenne Twister MT19937 as random number generator instead of standard `rand()` function (follow-up to r14865, r14870).
- It fixes issues caused by RAND_MAX being only 32k in Windows system (bugreport:1927, bugreport:86).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15483 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/md5calc.c | 3 | ||||
-rw-r--r-- | src/common/random.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/common/md5calc.c b/src/common/md5calc.c index 2178739d6..05fde42cc 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.c @@ -6,6 +6,7 @@ * ***********************************************************/ +#include "../common/random.h" #include "md5calc.h" #include <string.h> #include <stdio.h> @@ -234,6 +235,6 @@ void MD5_Salt(unsigned int len, char * output) { unsigned int i; for( i = 0; i < len; ++i ) - output[i] = (char)(1 + rand() % 255); + output[i] = (char)(1 + rnd() % 255); } diff --git a/src/common/random.c b/src/common/random.c index b7f2c080c..6bdcaca2f 100644 --- a/src/common/random.c +++ b/src/common/random.c @@ -1,6 +1,7 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder +#include "../common/showmsg.h" #include "../common/timer.h" // gettick #include "random.h" #if defined(WIN32) @@ -30,6 +31,7 @@ void rnd_init(void) seed += (uint32)gettid(); #endif // HAVE_GETTID #endif + ShowInfo("Initializing random number generator.\n") init_genrand(seed); } |