mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 19:10:25 +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
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user