X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..refs/heads/master:/runtime/WeakRandom.h diff --git a/runtime/WeakRandom.h b/runtime/WeakRandom.h index 6083980..98b23c7 100644 --- a/runtime/WeakRandom.h +++ b/runtime/WeakRandom.h @@ -56,12 +56,15 @@ namespace JSC { class WeakRandom { +friend class JSGlobalObject; // For access to initializeSeed() during replay. public: WeakRandom(unsigned seed) - : m_low(seed ^ 0x49616E42) - , m_high(seed) { + initializeSeed(seed); } + + // Returns the seed provided that you've never called get() or getUint32(). + unsigned seedUnsafe() const { return m_high; } double get() { @@ -82,6 +85,12 @@ private: return m_high; } + void initializeSeed(unsigned seed) + { + m_low = seed ^ 0x49616E42; + m_high = seed; + } + unsigned m_low; unsigned m_high; };