diff options
Diffstat (limited to 'source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp index c3a8ba0e467..a12619aa925 100644 --- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp @@ -65,7 +65,8 @@ SCA_RandomNumberGenerator::~SCA_RandomNumberGenerator() { /* intentionally empty */ } -void SCA_RandomNumberGenerator::SetStartVector(void) { +void SCA_RandomNumberGenerator::SetStartVector(void) +{ /* setting initial seeds to mt[N] using */ /* the generator Line 25 of Table 1 in */ /* [KNUTH 1981, The Art of Computer Programming */ @@ -85,7 +86,8 @@ void SCA_RandomNumberGenerator::SetSeed(long newseed) /** * This is the important part: copied verbatim :) */ -unsigned long SCA_RandomNumberGenerator::Draw() { +unsigned long SCA_RandomNumberGenerator::Draw() +{ static unsigned long mag01[2] = { 0x0, MATRIX_A }; /* mag01[x] = x * MATRIX_A for x=0,1 */ @@ -121,7 +123,8 @@ unsigned long SCA_RandomNumberGenerator::Draw() { return y; } -float SCA_RandomNumberGenerator::DrawFloat() { +float SCA_RandomNumberGenerator::DrawFloat() +{ return ( (float) Draw()/ (unsigned long) 0xffffffff ); } |