From a62794b0bfa1d2bfc8907a1e4d4e5aa6fe3ee426 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Fri, 11 Nov 2011 19:49:46 +0200
Subject: [PATCH 3/8] Allow frontend to control random number seed

---
 snes/interface/interface.cpp | 5 +++++
 snes/interface/interface.hpp | 1 +
 snes/system/system.cpp       | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index b3017c9..0a21a13 100755
--- a/snes/interface/interface.cpp
+++ b/snes/interface/interface.cpp
@@ -23,4 +23,9 @@ time_t Interface::currentTime()
   return time(0);
 }
 
+time_t Interface::randomSeed()
+{
+  return time(0);
+}
+
 }
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
index df975e8..30ee7fd 100755
--- a/snes/interface/interface.hpp
+++ b/snes/interface/interface.hpp
@@ -6,6 +6,7 @@ struct Interface {
   virtual string path(Cartridge::Slot slot, const string &hint) = 0;
   virtual void message(const string &text);
   virtual time_t currentTime();
+  virtual time_t randomSeed();
 };
 
 extern Interface *interface;
diff --git a/snes/system/system.cpp b/snes/system/system.cpp
index 284e389..99901ff 100755
--- a/snes/system/system.cpp
+++ b/snes/system/system.cpp
@@ -151,7 +151,7 @@ void System::unload() {
 }
 
 void System::power() {
-  random.seed((unsigned)time(0));
+  random.seed((unsigned)interface->randomSeed());
 
   region = config.region;
   expansion = config.expansion_port;
-- 
1.8.4.4

