mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Ref T486 Using QRandomGenerator.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "integersequence.h"
|
||||
|
||||
#include <QThreadStorage>
|
||||
#include <QRandomGenerator>
|
||||
#include <QtGlobal>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
@@ -51,7 +52,7 @@ namespace BlackMisc
|
||||
{
|
||||
//! \fixme Qt 5.10: Use QRandomGenerator.
|
||||
static QThreadStorage<std::mt19937> rng;
|
||||
if (rng.hasLocalData()) { rng.setLocalData(std::mt19937(static_cast<std::mt19937::result_type>(qrand()))); }
|
||||
if (rng.hasLocalData()) { rng.setLocalData(std::mt19937(static_cast<std::mt19937::result_type>(QRandomGenerator::global()->generate()))); }
|
||||
return rng.localData();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user