TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
random.cpp
Go to the documentation of this file.
1 #include "random.h"
2 #include "ttkqtglobal.h"
3 
4 #if TTK_QT_VERSION_CHECK(5,10,0)
5 # include <QRandomGenerator>
6 #endif
7 
8 namespace QAlgorithm
9 {
10 void initRandom()
11 {
12 #if !TTK_QT_VERSION_CHECK(5,10,0)
13  qsrand(QDateTime::currentMSecsSinceEpoch());
14 #endif
15 }
16 
17 int random(int value)
18 {
19 #if TTK_QT_VERSION_CHECK(5,10,0)
20  return QRandomGenerator::global()->bounded(value);
21 #else
22  return qrand() % value;
23 #endif
24 }
25 }
void initRandom()
Definition: random.cpp:10
The namespace of the algorithm.
int random(int value)
Definition: random.cpp:17