Changeset View
Changeset View
Standalone View
Standalone View
dealer.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
45 | #include "patsolve/solverinterface.h" | 45 | #include "patsolve/solverinterface.h" | ||
46 | #include "view.h" | 46 | #include "view.h" | ||
47 | 47 | | |||
48 | #include "KCardTheme" | 48 | #include "KCardTheme" | ||
49 | 49 | | |||
50 | #include <KConfigGroup> | 50 | #include <KConfigGroup> | ||
51 | #include <KLocalizedString> | 51 | #include <KLocalizedString> | ||
52 | #include <KMessageBox> | 52 | #include <KMessageBox> | ||
53 | #include <KRandom> | 53 | #include <QRandomGenerator> | ||
54 | #include <KSharedConfig> | 54 | #include <KSharedConfig> | ||
55 | 55 | | |||
56 | #include <QThread> | 56 | #include <QThread> | ||
57 | #include <QXmlStreamReader> | 57 | #include <QXmlStreamReader> | ||
58 | #include <QXmlStreamWriter> | 58 | #include <QXmlStreamWriter> | ||
59 | #include <QGraphicsSceneMouseEvent> | 59 | #include <QGraphicsSceneMouseEvent> | ||
60 | 60 | | |||
61 | #include <cmath> | 61 | #include <cmath> | ||
▲ Show 20 Lines • Show All 722 Lines • ▼ Show 20 Line(s) | 778 | #endif | |||
784 | 784 | | |||
785 | if ( hintList.isEmpty() ) | 785 | if ( hintList.isEmpty() ) | ||
786 | { | 786 | { | ||
787 | return MoveHint(); | 787 | return MoveHint(); | ||
788 | } | 788 | } | ||
789 | else | 789 | else | ||
790 | { | 790 | { | ||
791 | // Generate a random number with an exponentional distribution averaging 1/4. | 791 | // Generate a random number with an exponentional distribution averaging 1/4. | ||
792 | qreal randomExp = qMin<qreal>( -log( 1 - qreal( KRandom::random() ) / RAND_MAX ) / 4, 1 ); | 792 | qreal randomExp = qMin<qreal>( -log( 1 - qreal( QRandomGenerator::global()->generate() ) / RAND_MAX ) / 4, 1 ); | ||
coatesUnsubmitted Not Done coates: ```
qreal randomExp = qMin<qreal>( -log( 1 - QRandomGenerator::global()::generateDouble() ) / 4… | |||||
793 | int randomIndex = randomExp * ( hintList.size() - 1 ); | 793 | int randomIndex = randomExp * ( hintList.size() - 1 ); | ||
794 | 794 | | |||
795 | std::sort(hintList.begin(), hintList.end(), prioSort); | 795 | std::sort(hintList.begin(), hintList.end(), prioSort); | ||
796 | return hintList.at( randomIndex ); | 796 | return hintList.at( randomIndex ); | ||
797 | } | 797 | } | ||
798 | } | 798 | } | ||
799 | 799 | | |||
800 | 800 | | |||
▲ Show 20 Lines • Show All 1311 Lines • Show Last 20 Lines |