From 1d19bd11d0efc4d7e8a5d1a082bb2e12cb887560 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 25 Dec 2016 21:06:02 -0500 Subject: [PATCH] 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. --- common/random.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/random.h b/common/random.h index 44be53e98..0c877bfea 100644 --- a/common/random.h +++ b/common/random.h @@ -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 void Shuffle(RandomAccessIterator first, RandomAccessIterator last)