Index: runtime/vm/random.cc |
diff --git a/runtime/vm/random.cc b/runtime/vm/random.cc |
index 18703d0d315f16e6a24e2e5ce0625d121d2793fa..6f1b6eba17641f7c9064a7efacef96979622cc67 100644 |
--- a/runtime/vm/random.cc |
+++ b/runtime/vm/random.cc |
@@ -25,6 +25,12 @@ Random::Random() { |
// We did not get a seed so far. As a fallback we do use the current time. |
seed = OS::GetCurrentTimeMicros(); |
} |
+ Initialize(seed); |
+} |
+ |
+ |
+void Random::Initialize(uint64_t seed) { |
+ ASSERT(seed != 0); |
// Crank the next state a couple of times. |
_state = seed; |
NextState(); |
@@ -33,6 +39,12 @@ Random::Random() { |
NextState(); |
} |
+ |
+Random::Random(uint64_t seed) { |
+ Initialize(seed); |
+} |
+ |
+ |
Random::~Random() { |
// Nothing to be done here. |
} |