From e66a408e38849107a3d35a317ff6f2b23dcaeead Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Tue, 30 Oct 2018 20:00:32 -0700 Subject: RM static cast, lower warning level, add homebrew RNG --- Source/RandomizerCore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Source/RandomizerCore.cpp') diff --git a/Source/RandomizerCore.cpp b/Source/RandomizerCore.cpp index 77977c6..684e19d 100644 --- a/Source/RandomizerCore.cpp +++ b/Source/RandomizerCore.cpp @@ -1,5 +1,6 @@ #include "RandomizerCore.h" #include "Memory.h" +#include "Random.h" #include void RandomizerCore::Randomize(std::vector& panels, int flags) { @@ -12,7 +13,7 @@ void RandomizerCore::RandomizeRange(std::vector &panels, int flags, size_t if (startIndex >= endIndex) return; if (endIndex >= panels.size()) endIndex = panels.size(); for (size_t i = endIndex-1; i > startIndex; i--) { - const size_t target = rand() % (i - startIndex) + startIndex; + const size_t target = Random::RandInt(startIndex, i); if (i != target) { // std::cout << "Swapping panels " << std::hex << panels[i] << " and " << std::hex << panels[target] << std::endl; SwapPanels(panels[i], panels[target], flags); -- cgit 1.4.1