X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/bf5d7992ce29e9fb006a5b6770bd3457b9b0f18b..4653da43318d7b0ac4de7d313ee7c017af4914cb:/common/random.c diff --git a/common/random.c b/common/random.c index 62d0cbeb..df549968 100644 --- a/common/random.c +++ b/common/random.c @@ -1,6 +1,6 @@ #include "random.h" -static uint64_t next_random = 1; + uint64_t next_random = 1; /* Generates a (non-cryptographically secure) 32-bit random number. * @@ -13,7 +13,9 @@ uint32_t prand() { if (next_random == 1) next_random = GetTickCount(); - next_random = next_random * 6364136223846793005 + 1; + next_random *= 6364136223846793005; + next_random += 1; + return (uint32_t)(next_random >> 32) % 0xffffffff; }