summaryrefslogtreecommitdiffstats
path: root/kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp')
-rw-r--r--kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp b/kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp
index 19b977c1..4b287b83 100644
--- a/kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp
+++ b/kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp
@@ -40,6 +40,7 @@
#include <tqpushbutton.h>
#include <algorithm>
+#include <random>
using namespace std;
MCQueryDlg::MCQueryDlg(
@@ -137,13 +138,16 @@ void MCQueryDlg::setQuery(TQString org,
mw->timebar->setEnabled(false);
vector<TQString> strings;
+ random_device randomDev;
+ mt19937 randomGenerator(randomDev());
+
button_ref.clear();
button_ref.push_back(RB_Label(mw->rb_trans1, mw->trans1));
button_ref.push_back(RB_Label(mw->rb_trans2, mw->trans2));
button_ref.push_back(RB_Label(mw->rb_trans3, mw->trans3));
button_ref.push_back(RB_Label(mw->rb_trans4, mw->trans4));
button_ref.push_back(RB_Label(mw->rb_trans5, mw->trans5));
- random_shuffle(button_ref.begin(), button_ref.end() );
+ shuffle(button_ref.begin(), button_ref.end(), randomGenerator);
resetButton(button_ref[0].rb, button_ref[0].label);
resetButton(button_ref[1].rb, button_ref[1].label);
resetButton(button_ref[2].rb, button_ref[2].label);
@@ -155,7 +159,7 @@ void MCQueryDlg::setQuery(TQString org,
MultipleChoice mc = exp->getMultipleChoice(q_tcol);
for (unsigned i = 0; i < TQMIN(MAX_MULTIPLE_CHOICE, mc.size()); ++i)
strings.push_back(mc.mc(i));
- std::random_shuffle(strings.begin(), strings.end());
+ shuffle(strings.begin(), strings.end(), randomGenerator);
// always include false friend
TQString ff;