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
+3 -3
View File
@@ -1300,13 +1300,13 @@ void Zone::ChangeWeather()
return;
}
int chance = MakeRandomInt(0, 3);
int chance = zone->random.Int(0, 3);
uint8 rainchance = zone->newzone_data.rain_chance[chance];
uint8 rainduration = zone->newzone_data.rain_duration[chance];
uint8 snowchance = zone->newzone_data.snow_chance[chance];
uint8 snowduration = zone->newzone_data.snow_duration[chance];
uint32 weathertimer = 0;
uint16 tmpweather = MakeRandomInt(0, 100);
uint16 tmpweather = zone->random.Int(0, 100);
uint8 duration = 0;
uint8 tmpOldWeather = zone->zone_weather;
bool changed = false;
@@ -1315,7 +1315,7 @@ void Zone::ChangeWeather()
{
if(rainchance > 0 || snowchance > 0)
{
uint8 intensity = MakeRandomInt(1, 10);
uint8 intensity = zone->random.Int(1, 10);
if((rainchance > snowchance) || (rainchance == snowchance))
{
//It's gunna rain!