mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28: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,6 +3,7 @@
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/rulesys.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 EQEmu::Random emu_random;
|
||||
|
||||
AdventureManager::AdventureManager()
|
||||
{
|
||||
@@ -325,7 +327,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
|
||||
if(eligible_adventures.size() > 0)
|
||||
{
|
||||
ea_iter = eligible_adventures.begin();
|
||||
int c_index = MakeRandomInt(0, (eligible_adventures.size()-1));
|
||||
int c_index = emu_random.Int(0, (eligible_adventures.size()-1));
|
||||
for(int i = 0; i < c_index; ++i)
|
||||
{
|
||||
++ea_iter;
|
||||
|
||||
Reference in New Issue
Block a user