D26201: Port away from KRandom

Parker Coates noreply at phabricator.kde.org
Thu Jan 16 16:57:39 GMT 2020


coates added inline comments.

INLINE COMMENTS

> mainwindow.cpp:411
> +    const auto seed = QRandomGenerator::global()->generate();
> +    const int signed_seed = (int)(seed & (~(((quint32)1) << 31)));
> +    startNew(signed_seed);

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);

REPOSITORY
  R410 KPatience

REVISION DETAIL
  https://phabricator.kde.org/D26201

To: nicolasfella, #kde_games, shlomif
Cc: coates, shlomif, kde-games-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20200116/d8e94f12/attachment.html>


More information about the kde-games-devel mailing list