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 -1
View File
@@ -25,8 +25,10 @@
#include "zonedb.h"
#include "../common/misc_functions.h"
#include "../common/string_util.h"
#include "zone.h"
extern EntityList entity_list;
extern Zone* zone;
SpawnEntry::SpawnEntry( uint32 in_NPCType, int in_chance, uint8 in_npc_spawn_limit ) {
NPCType = in_NPCType;
@@ -77,7 +79,7 @@ uint32 SpawnGroup::GetNPCType() {
int32 roll = 0;
roll = MakeRandomInt(0, totalchance-1);
roll = zone->random.Int(0, totalchance-1);
cur = possible.begin();
end = possible.end();