Lines 1-29
Link Here
|
1 |
--- src/mpdpp.cpp.orig 2016-04-17 05:41:01 UTC |
|
|
2 |
+++ src/mpdpp.cpp |
3 |
@@ -105,6 +105,8 @@ Connection::Connection() : m_connection( |
4 |
m_port(6600), |
5 |
m_timeout(15) |
6 |
{ |
7 |
+ std::random_device rd; |
8 |
+ m_gen.seed(rd()); |
9 |
} |
10 |
|
11 |
void Connection::Connect() |
12 |
@@ -570,7 +572,7 @@ bool Connection::AddRandomTag(mpd_tag_ty |
13 |
if (number > tags.size()) |
14 |
return false; |
15 |
|
16 |
- std::random_shuffle(tags.begin(), tags.end()); |
17 |
+ std::shuffle(tags.begin(), tags.end(), m_gen); |
18 |
auto it = tags.begin(); |
19 |
for (size_t i = 0; i < number && it != tags.end(); ++i) |
20 |
{ |
21 |
@@ -609,7 +611,7 @@ bool Connection::AddRandomSongs(size_t n |
22 |
} |
23 |
else |
24 |
{ |
25 |
- std::random_shuffle(files.begin(), files.end()); |
26 |
+ std::shuffle(files.begin(), files.end(), m_gen); |
27 |
StartCommandsList(); |
28 |
auto it = files.begin(); |
29 |
for (size_t i = 0; i < number && it != files.end(); ++i, ++it) |