Skip to content

Commit 7170998

Browse files
committed
Use C++11 random lib instead of qrand()
1 parent 55f68e6 commit 7170998

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ConnectionStyle.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "ConnectionStyle.hpp"
22

3-
#include <iostream>
3+
#include "StyleCollection.hpp"
44

55
#include <QtCore/QFile>
66
#include <QtCore/QJsonDocument>
@@ -10,7 +10,7 @@
1010

1111
#include <QDebug>
1212

13-
#include "StyleCollection.hpp"
13+
#include <random>
1414

1515
using QtNodes::ConnectionStyle;
1616

@@ -166,8 +166,10 @@ normalColor(QString typeId) const
166166

167167
std::size_t const hue_range = 0xFF;
168168

169-
qsrand(hash);
170-
std::size_t hue = qrand() % hue_range;
169+
std::mt19937 gen(hash);
170+
std::uniform_int_distribution<> distrib(0, hue_range);
171+
172+
std::size_t hue = distrib(gen);
171173

172174
std::size_t sat = 120 + hash % 129;
173175

0 commit comments

Comments
 (0)