diff options
Diffstat (limited to 'kvoctrain')
-rw-r--r-- | kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp | 14 | ||||
-rw-r--r-- | kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp | 8 |
2 files changed, 13 insertions, 9 deletions
diff --git a/kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp b/kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp index 906c3753..4d364bbc 100644 --- a/kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp +++ b/kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp @@ -472,7 +472,7 @@ void kvoctrainDoc::setSizeHint (int idx, const int width) } -class eraseTrans : public unary_function<kvoctrainExpr, void> +class eraseTrans : public function<void(kvoctrainExpr)> { public: @@ -516,7 +516,7 @@ void kvoctrainDoc::setOriginalIdent (const TQString &id) } -class sortByOrg : public binary_function<kvoctrainExpr, kvoctrainExpr, bool> +class sortByOrg : public function<bool(kvoctrainExpr, kvoctrainExpr)> { public: @@ -540,7 +540,7 @@ public: class sortByLessonAndOrg_alpha - : public binary_function<kvoctrainExpr, kvoctrainExpr, bool> + : public function<bool(kvoctrainExpr, kvoctrainExpr)> { public: @@ -573,7 +573,7 @@ public: class sortByLessonAndOrg_index - : public binary_function<kvoctrainExpr, kvoctrainExpr, bool> + : public function<bool(kvoctrainExpr, kvoctrainExpr)> { public: @@ -603,7 +603,7 @@ public: }; -class sortByTrans : public binary_function<kvoctrainExpr, kvoctrainExpr, bool> +class sortByTrans : public function<bool(kvoctrainExpr, kvoctrainExpr)> { public: @@ -675,7 +675,7 @@ bool kvoctrainDoc::sortByLesson_index () } -class resetAll : public unary_function<kvoctrainExpr, void> +class resetAll : public function<void(kvoctrainExpr)> { public: @@ -703,7 +703,7 @@ public: }; -class resetOne : public unary_function<kvoctrainExpr, void> +class resetOne : public function<void(kvoctrainExpr)> { public: 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; |