See T12093
Details
Details
Diff Detail
Diff Detail
- Repository
- R410 KPatience
- Branch
- krandom
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 20231 Build 20249: arc lint + arc unit
Comment Actions
Thanks for the patch! It looks fine at first glance, but I noticed that when you deal the first game after the game variant carousel ([kpat start] → Freecell) the deal index in the window's title is always "1". It doesn't happen with the current git master ( 96de699e8fe1b6c56881b29761384b5a600ad6ab ).
Comment Actions
Here is a fixed startRandom():
void MainWindow::startRandom() { const auto seed = QRandomGenerator::global()->generate(); const int signed_seed = (int)(seed & (~(((quint32)1) << 31))); startNew(signed_seed); }
Comment Actions
Using QRandomGenerator, but keeping RAND_MAX is really only a half port. Please, use QRandomGenerator's convenient generation functions.
dealer.cpp | ||
---|---|---|
792 | qreal randomExp = qMin<qreal>( -log( 1 - QRandomGenerator::global()::generateDouble() ) / 4, 1 ); | |
mainwindow.cpp | ||
422 | KCardTheme theme = themes.at( QRandomGenerator::global()->bounded( themes.size() ) ); | |
spider.cpp | ||
406 | qreal x = rect.left() + QRandomGenerator::global()::bounded(rect.width() - deck()->cardWidth()); qreal y = rect.top() + QRandomGenerator::global()::bounded(rect.height() - deck()->cardHeight()); |
mainwindow.cpp | ||
---|---|---|
411 | Personally, I think the following would be more readable, but at minimum a comment explaining the bit fiddling would be appropriate. const int gameNumber = int(QRandomGenerator::global()->bounded(quint32(0), quint32(INT_MAX) + 1)); startNew(gameNumber); |