diff --git a/src/perfect/perfect_player.cpp b/src/perfect/perfect_player.cpp index f6f525121..442d65465 100644 --- a/src/perfect/perfect_player.cpp +++ b/src/perfect/perfect_player.cpp @@ -444,9 +444,10 @@ int PerfectPlayer::NGMAfterMove(const GameState &s, AdvancedMove &m) template T PerfectPlayer::chooseRandom(const std::vector &l) { + static std::random_device rd; + static std::mt19937 gen(rd()); + if (gameOptions.getShufflingEnabled()) { - std::random_device rd; - std::mt19937 gen(rd()); std::uniform_int_distribution<> dis(0, static_cast(l.size() - 1)); return l[dis(gen)]; }