Skip to content

Commit d865383

Browse files
committed
background: do not use deprecated std::random_shuffle
Fixes #49
1 parent 6ab5a9a commit d865383

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/background/background.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#include <gdkmm/general.h>
88
#include <gdk/gdkwayland.h>
99

10+
#include <random>
11+
#include <algorithm>
12+
1013
#include <iostream>
1114
#include <map>
1215

@@ -141,8 +144,9 @@ bool WayfireBackground::load_images_from_dir(std::string path)
141144

142145
if (background_randomize && images.size())
143146
{
144-
srand(time(0));
145-
std::random_shuffle(images.begin(), images.end());
147+
std::random_device random_device;
148+
std::mt19937 random_gen(random_device());
149+
std::shuffle(images.begin(), images.end(), random_gen);
146150
}
147151

148152
return true;

0 commit comments

Comments
 (0)