summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-04-23 16:23:05 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-04-23 16:23:05 (GMT)
commit8e6a76a58c56d0d045e6b2b720fbc35d2e72d2f2 (patch)
treec7cbef09af4e36ddd5c82491169dbc14db8842b1 /Swiften/Base/BoostRandomGenerator.cpp
parent7bd058600b682781abb3fd93bfaf516e7d8d7b23 (diff)
downloadswift-contrib-8e6a76a58c56d0d045e6b2b720fbc35d2e72d2f2.zip
swift-contrib-8e6a76a58c56d0d045e6b2b720fbc35d2e72d2f2.tar.bz2
Seed the random number generator.
Diffstat (limited to 'Swiften/Base/BoostRandomGenerator.cpp')
-rw-r--r--Swiften/Base/BoostRandomGenerator.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Swiften/Base/BoostRandomGenerator.cpp b/Swiften/Base/BoostRandomGenerator.cpp
index 62c3055..e58ec95 100644
--- a/Swiften/Base/BoostRandomGenerator.cpp
+++ b/Swiften/Base/BoostRandomGenerator.cpp
@@ -12,6 +12,11 @@
namespace Swift {
+BoostRandomGenerator::BoostRandomGenerator() {
+ // FIXME: Not a good seed
+ generator.seed(static_cast<unsigned int>(std::time(0)));
+}
+
int BoostRandomGenerator::generateRandomInteger(int maximum) {
boost::uniform_int<> distribution(0, maximum);
return distribution(generator);