diff options
| author | jbzdarkid <jbzdarkid@gmail.com> | 2018-10-30 20:00:32 -0700 | 
|---|---|---|
| committer | jbzdarkid <jbzdarkid@gmail.com> | 2018-10-30 20:00:32 -0700 | 
| commit | e66a408e38849107a3d35a317ff6f2b23dcaeead (patch) | |
| tree | 2e2abb9c80997c0565fddce4e7e271d901839b26 /Source/RandomizerCore.cpp | |
| parent | 2ec4950107245df8f01860a3289b7731753933cd (diff) | |
| download | witness-tutorializer-e66a408e38849107a3d35a317ff6f2b23dcaeead.tar.gz witness-tutorializer-e66a408e38849107a3d35a317ff6f2b23dcaeead.tar.bz2 witness-tutorializer-e66a408e38849107a3d35a317ff6f2b23dcaeead.zip | |
RM static cast, lower warning level, add homebrew RNG
Diffstat (limited to 'Source/RandomizerCore.cpp')
| -rw-r--r-- | Source/RandomizerCore.cpp | 3 | 
1 files changed, 2 insertions, 1 deletions
| 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 @@ | |||
| 1 | #include "RandomizerCore.h" | 1 | #include "RandomizerCore.h" | 
| 2 | #include "Memory.h" | 2 | #include "Memory.h" | 
| 3 | #include "Random.h" | ||
| 3 | #include <sstream> | 4 | #include <sstream> | 
| 4 | 5 | ||
| 5 | void RandomizerCore::Randomize(std::vector<int>& panels, int flags) { | 6 | void RandomizerCore::Randomize(std::vector<int>& panels, int flags) { | 
| @@ -12,7 +13,7 @@ void RandomizerCore::RandomizeRange(std::vector<int> &panels, int flags, size_t | |||
| 12 | if (startIndex >= endIndex) return; | 13 | if (startIndex >= endIndex) return; | 
| 13 | if (endIndex >= panels.size()) endIndex = panels.size(); | 14 | if (endIndex >= panels.size()) endIndex = panels.size(); | 
| 14 | for (size_t i = endIndex-1; i > startIndex; i--) { | 15 | for (size_t i = endIndex-1; i > startIndex; i--) { | 
| 15 | const size_t target = rand() % (i - startIndex) + startIndex; | 16 | const size_t target = Random::RandInt(startIndex, i); | 
| 16 | if (i != target) { | 17 | if (i != target) { | 
| 17 | // std::cout << "Swapping panels " << std::hex << panels[i] << " and " << std::hex << panels[target] << std::endl; | 18 | // std::cout << "Swapping panels " << std::hex << panels[i] << " and " << std::hex << panels[target] << std::endl; | 
| 18 | SwapPanels(panels[i], panels[target], flags); | 19 | SwapPanels(panels[i], panels[target], flags); | 
