Skip to content
Permalink
Browse files

Use M constant explicitely in permgen.cpp

  • Loading branch information
remram44 committed Feb 7, 2015
1 parent ad831ea commit f0ded1e3a9ec81aa7519d2e675e1063e8762aeb6
Showing with 2 additions and 2 deletions.
  1. +2 −2 permgen.cpp
@@ -1,7 +1,7 @@
#include "permgen.h"


//constexpr Key M = 1 << 32;
constexpr Key M = 0xFFFFFFFF;
constexpr Key A = 1103515245;
constexpr Key C = 12345;

@@ -13,7 +13,7 @@ Generator::Generator(Key max)
Key Generator::generate(Key state)
{
do
state = (A * state + C) & 0xFFFFFFFF;
state = (A * state + C) & M;
while(state > m_Max);
return state;
}

0 comments on commit f0ded1e

Please sign in to comment.
You can’t perform that action at this time.