X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhelperfuncs.cpp;h=6830612c70bedbc1bf0ee473aef6673d7d18d84e;hb=36e701f4abfa6d8fc4f096be023a681a6b7cec2e;hp=8ced78ae8ac720d880f14d34cdba42da5144ddc7;hpb=87361360e67d105df148ba0daa52f1164ce1d15a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 8ced78ae8..6830612c7 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -477,8 +477,11 @@ unsigned long InspIRCd::GenRandomInt(unsigned long max) // This is overridden by a higher-quality algorithm when SSL support is loaded void InspIRCd::DefaultGenRandom(char* output, size_t max) { - for(unsigned int i=0; i < max; i++) -#ifdef _WIN32 +#if defined HAS_ARC4RANDOM_BUF + arc4random_buf(output, max); +#else + for (unsigned int i = 0; i < max; ++i) +# ifdef _WIN32 { unsigned int uTemp; if(rand_s(&uTemp) != 0) @@ -486,7 +489,8 @@ void InspIRCd::DefaultGenRandom(char* output, size_t max) else output[i] = uTemp; } -#else +# else output[i] = random(); +# endif #endif }