forked from qt-creator/qt-creator
Replace qrand with QRandomGenerator
Task-number: QTCREATORBUG-24098 Change-Id: I91b610409a413c7d76b3c5dd43cf581a960edf7d Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <QColor>
|
||||
#include <QMap>
|
||||
#include <QRandomGenerator>
|
||||
#include <QString>
|
||||
|
||||
namespace Valgrind {
|
||||
@@ -42,9 +43,10 @@ QColor CallgrindHelper::colorForString(const QString &text)
|
||||
return colorCache.value(text);
|
||||
|
||||
// Minimum lightness of 100 to be readable with black text.
|
||||
const QColor color = QColor::fromHsl(((qreal)qrand() / RAND_MAX * 359),
|
||||
((qreal)qrand() / RAND_MAX * 255),
|
||||
((qreal)qrand() / RAND_MAX * 127) + 128);
|
||||
const QColor color = QColor::fromHsl(
|
||||
((qreal) QRandomGenerator::global()->generate() / RAND_MAX * 359),
|
||||
((qreal) QRandomGenerator::global()->generate() / RAND_MAX * 255),
|
||||
((qreal) QRandomGenerator::global()->generate() / RAND_MAX * 127) + 128);
|
||||
colorCache[text] = color;
|
||||
return color;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user