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
+5 -1
View File
@@ -22,6 +22,7 @@
#include "../common/linked_list.h"
#include "../common/rulesys.h"
#include "../common/types.h"
#include "../common/random.h"
#include "qglobals.h"
#include "spawn2.h"
#include "spawngroup.h"
@@ -253,6 +254,9 @@ public:
void UpdateHotzone();
std::unordered_map<int, item_tick_struct> tick_items;
// random object that provides random values for the zone
EQEmu::Random random;
//MODDING HOOKS
void mod_init();
void mod_repop();
@@ -310,7 +314,7 @@ private:
Timer* Instance_Warning_timer;
LinkedList<ZoneClientAuth_Struct*> client_auth_list;
QGlobalCache *qGlobals;
Timer hotzone_timer;
};