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
+4 -2
View File
@@ -4,6 +4,7 @@
#include "../common/rulesys.h"
#include "../common/misc_functions.h"
#include "../common/string_util.h"
#include "../common/random.h"
#include "adventure.h"
#include "adventure_manager.h"
#include "worlddb.h"
@@ -14,6 +15,7 @@
extern ZSList zoneserver_list;
extern ClientList client_list;
extern AdventureManager adventure_manager;
extern EQEmu::Random emu_random;
Adventure::Adventure(AdventureTemplate *t)
{
@@ -392,8 +394,8 @@ void Adventure::MoveCorpsesToGraveyard()
for (auto iter = dbid_list.begin(); iter != dbid_list.end(); ++iter)
{
float x = GetTemplate()->graveyard_x + MakeRandomFloat(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float y = GetTemplate()->graveyard_y + MakeRandomFloat(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float x = GetTemplate()->graveyard_x + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float y = GetTemplate()->graveyard_y + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float z = GetTemplate()->graveyard_z;
query = StringFormat("UPDATE character_corpses "