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.
This commit is contained in:
Michael Cook (mackal) 2016-12-25 21:06:02 -05:00
parent 630ea0d3c6
commit 1d19bd11d0

View File

@ -65,6 +65,15 @@ namespace EQEmu {
return Real(0.0, 1.0) <= required;
}
// same range as client's roll0
// This is their main high level RNG function
int Roll0(int max)
{
if (max - 1 > 0)
return Int(0, max - 1);
return 0;
}
// std::shuffle requires a RNG engine passed to it, so lets provide a wrapper to use our engine
template<typename RandomAccessIterator>
void Shuffle(RandomAccessIterator first, RandomAccessIterator last)