Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(888)

Unified Diff: runtime/vm/random.cc

Issue 1337943004: Add ThreadBarrier; use in GCMarker and unit test (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix git again. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/random.h ('k') | runtime/vm/thread_barrier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
}
« no previous file with comments | « runtime/vm/random.h ('k') | runtime/vm/thread_barrier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698