|
From: Tapio V. <aa...@us...> - 2009-11-08 08:31:15
|
Module: performous
Branch: dance
Commit: 1f319d424719882f2d5299def9860fc36da81abd
Author: Tapio Vierros <tap...@gm...>
Date: Sat Nov 7 18:07:27 2009 +0200
Moved RNG seeding to main()
---
game/backgrounds.cc | 2 --
game/main.cc | 2 ++
game/songs.cc | 1 -
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/game/backgrounds.cc b/game/backgrounds.cc
index a854442..8450234 100644
--- a/game/backgrounds.cc
+++ b/game/backgrounds.cc
@@ -12,7 +12,6 @@
#include <sstream>
#include <stdexcept>
#include <cstdlib>
-#include <ctime>
void Backgrounds::reload() {
if (m_loading) return;
@@ -48,7 +47,6 @@ void Backgrounds::reload_internal() {
m_loading = false;
{
boost::mutex::scoped_lock l(m_mutex);
- std::srand(time(NULL));
random_shuffle(m_bgs.begin(), m_bgs.end());
m_dirty = false;
m_bgiter = 0;
diff --git a/game/main.cc b/game/main.cc
index 6748fc5..5341fd5 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -27,6 +27,7 @@
#include <fstream>
#include <string>
#include <vector>
+#include <cstdlib>
volatile bool g_quit = false;
@@ -197,6 +198,7 @@ int main(int argc, char** argv) {
std::signal(SIGINT, quit);
std::signal(SIGTERM, quit);
std::ios::sync_with_stdio(false); // We do not use C stdio
+ std::srand(std::time(NULL));
// Parse commandline options
std::vector<std::string> mics;
std::vector<std::string> pdevs;
diff --git a/game/songs.cc b/game/songs.cc
index 0dbe269..f98ce87 100644
--- a/game/songs.cc
+++ b/game/songs.cc
@@ -134,7 +134,6 @@ void Songs::randomize_internal() {
rnd::mt19937 gen(gendev); // Make Mersenne Twister random number generator, seeded with random_device.
for (SongVector::const_iterator it = m_filtered.begin(); it != m_filtered.end(); ++it) (*it)->randomIdx = gen();
*/
- std::srand(std::time(NULL));
// Assign the songs randomIdx that is used for sorting in the "random" mode
for (SongVector::const_iterator it = m_filtered.begin(); it != m_filtered.end(); ++it) (*it)->randomIdx = std::rand();
m_order = 0; // Use randomIdx sort mode
|