comparison Random.cpp @ 1292:24bc24b64ec2

Слияние
author Ritor1
date Fri, 14 Jun 2013 16:06:30 +0600
parents 0aeac0b9ca30
children 7a9477135943
comparison
equal deleted inserted replaced
1291:1577d75db258 1292:24bc24b64ec2
1 #include <math.h> 1 #include <math.h>
2 2
3 #include "Random.h" 3 #include "Random.h"
4 4 #include "Math.h"
5 #include "mm7_data.h"
6 5
7 6
8 7
9 8
10 struct Random *pRnd=new Random(); // idb 9 struct Random *pRnd=new Random(); // idb
48 Random *v1; // esi@1 47 Random *v1; // esi@1
49 float v2; // ST10_4@1 48 float v2; // ST10_4@1
50 double v3; // ST04_8@1 49 double v3; // ST04_8@1
51 int floored_random; // ecx@1 50 int floored_random; // ecx@1
52 51
53 v1 = this;
54 v2 = GetRandom() * (double)this->range; 52 v2 = GetRandom() * (double)this->range;
55 v3 = v2 + 6.7553994e15; 53 floored_random = bankersRounding(v2);
56 floored_random = LODWORD(v3); 54 if ( floored_random >= this->range )
57 if ( SLODWORD(v3) >= v1->range ) 55 floored_random = this->range;
58 floored_random = v1->range; 56 return floored_random + this->min;
59 return floored_random + v1->min;
60 } 57 }
61 58
62 //----- (004BE65D) -------------------------------------------------------- 59 //----- (004BE65D) --------------------------------------------------------
63 void Random::Initialize(int seed) 60 void Random::Initialize(int seed)
64 { 61 {