about summary refs log tree commit diff stats
path: root/Source/RandomizerCore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/RandomizerCore.cpp')
-rw-r--r--Source/RandomizerCore.cpp3
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
5void RandomizerCore::Randomize(std::vector<int>& panels, int flags) { 6void 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);