5 Commits

Author SHA1 Message Date
Michael Cook (mackal)
1d19bd11d0 Add Random::Roll0
This has the same interval ((0,N]) that the client function does
The devs have referenced this in a few posts talking about
mechanics.
2016-12-25 21:06:02 -05:00
Michael Cook (mackal)
62181ff08c Add Random::Shuffle
This is just a wrapper to std::shuffle since it requires a random
engine and ours lives in a class

Must pass random access iterators (array, vector, deque, etc)

ex:

std::vector<int> v;
/* init ... */
random.Shuffle(v.begin(), v.end());
2014-12-15 02:53:58 -05:00
Michael Cook (mackal)
026d5e71fa Adjust common/random.h based on N3551 2014-12-14 19:38:23 -05:00
Michael Cook (mackal)
6f867ebca3 Add license info 2014-12-01 19:50:05 -05:00
Michael Cook (mackal)
395be050a3 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
2014-12-01 18:13:12 -05:00