fixed deprecated random_shuffle
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "racelistgenerator.h"
|
||||
|
||||
#include <random>
|
||||
RaceListGenerator::RaceListGenerator(vector<int> driverIds,
|
||||
vector<int> carIds) {
|
||||
this->driverIds = driverIds;
|
||||
@@ -53,10 +53,17 @@ vector<vector<int>> RaceListGenerator::getList() {
|
||||
}
|
||||
|
||||
// shuffle shell list
|
||||
std::random_shuffle(shellList.begin(), shellList.end(), myrandom);
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 g(rd());
|
||||
|
||||
std::shuffle(shellList.begin(), shellList.end(), g);
|
||||
// std::random_shuffle(shellList.begin(), shellList.end(), myrandom);
|
||||
|
||||
while (1) {
|
||||
std::random_shuffle(deaList.begin(), deaList.end(), myrandom);
|
||||
|
||||
std::shuffle(deaList.begin(), deaList.end(), g);
|
||||
// std::random_shuffle(deaList.begin(), deaList.end(), myrandom);
|
||||
if (matchList(shellList, deaList) == true) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user