mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
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:
+3
-1
@@ -24,10 +24,12 @@
|
||||
#include "world_config.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/random.h"
|
||||
|
||||
extern uint32 numzones;
|
||||
extern bool holdzones;
|
||||
extern ConsoleList console_list;
|
||||
extern EQEmu::Random emu_random;
|
||||
void CatchSignal(int sig_num);
|
||||
|
||||
ZSList::ZSList()
|
||||
@@ -565,7 +567,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip
|
||||
safe_delete(tmp);
|
||||
return;
|
||||
}
|
||||
uint32 z = MakeRandomInt(0, y-1);
|
||||
uint32 z = emu_random.Int(0, y-1);
|
||||
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_ZoneReboot, sizeof(ServerZoneReboot_Struct));
|
||||
ServerZoneReboot_Struct* s = (ServerZoneReboot_Struct*) pack->pBuffer;
|
||||
|
||||
Reference in New Issue
Block a user