Switch random function to std::mt19937

Added class EQEmu::Random
Functions:
EQEmu::Random::Int(int low, int high)
EQEmu::Random::Real(double low, double high)
EQEmu::Random::Roll(int required)
EQEmu::Random::Roll(double required)
EQEmu::Random::Reseed()

For zone, you will access the random object through the zone object
ex.
	zone->random.Int(0, 100);

Int returns a random int between low and high
Real returns a random double between low and high
Roll(int) returns true if Int(0, 99) < required is true
Roll(double) returns true if Real(0.0, 1.0) <= required is true
This commit is contained in:
Michael Cook (mackal)
2014-12-01 18:13:12 -05:00
parent a59cdc2c89
commit 395be050a3
42 changed files with 683 additions and 799 deletions
+2 -2
View File
@@ -109,7 +109,7 @@ uint32 Spawn2::resetTimer()
if (variance_ != 0) {
int var_over_2 = (variance_ * 1000) / 2;
rspawn = MakeRandomInt(rspawn - var_over_2, rspawn + var_over_2);
rspawn = zone->random.Int(rspawn - var_over_2, rspawn + var_over_2);
//put a lower bound on it, not a lot of difference below 100, so set that as the bound.
if(rspawn < 100)
@@ -126,7 +126,7 @@ uint32 Spawn2::despawnTimer(uint32 despawn_timer)
if (variance_ != 0) {
int var_over_2 = (variance_ * 1000) / 2;
dspawn = MakeRandomInt(dspawn - var_over_2, dspawn + var_over_2);
dspawn = zone->random.Int(dspawn - var_over_2, dspawn + var_over_2);
//put a lower bound on it, not a lot of difference below 100, so set that as the bound.
if(dspawn < 100)