mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 15:00: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:
+2
-2
@@ -109,7 +109,7 @@ uint32 Spawn2::resetTimer()
|
||||
|
||||
if (variance_ != 0) {
|
||||
int var_over_2 = (variance_ * 1000) / 2;
|
||||
rspawn = MakeRandomInt(rspawn - var_over_2, rspawn + var_over_2);
|
||||
rspawn = zone->random.Int(rspawn - var_over_2, rspawn + var_over_2);
|
||||
|
||||
//put a lower bound on it, not a lot of difference below 100, so set that as the bound.
|
||||
if(rspawn < 100)
|
||||
@@ -126,7 +126,7 @@ uint32 Spawn2::despawnTimer(uint32 despawn_timer)
|
||||
|
||||
if (variance_ != 0) {
|
||||
int var_over_2 = (variance_ * 1000) / 2;
|
||||
dspawn = MakeRandomInt(dspawn - var_over_2, dspawn + var_over_2);
|
||||
dspawn = zone->random.Int(dspawn - var_over_2, dspawn + var_over_2);
|
||||
|
||||
//put a lower bound on it, not a lot of difference below 100, so set that as the bound.
|
||||
if(dspawn < 100)
|
||||
|
||||
Reference in New Issue
Block a user