diff options
| author | Pieter Wuille <[email protected]> | 2018-10-31 15:41:13 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2018-12-12 14:28:16 -0800 |
| commit | e414486d56b9f06af7aeb07ce13e3c3780c2b69b (patch) | |
| tree | 1014bfa4fe74fe860bd34e43fad8ef734c270f50 /src/random.h | |
| parent | Simplify testing RNG code (diff) | |
| download | discoin-e414486d56b9f06af7aeb07ce13e3c3780c2b69b.tar.xz discoin-e414486d56b9f06af7aeb07ce13e3c3780c2b69b.zip | |
Do not permit copying FastRandomContexts
Diffstat (limited to 'src/random.h')
| -rw-r--r-- | src/random.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/random.h b/src/random.h index e7e5eb496..00e90abbc 100644 --- a/src/random.h +++ b/src/random.h @@ -76,6 +76,14 @@ public: /** Initialize with explicit seed (only for testing) */ explicit FastRandomContext(const uint256& seed); + // Do not permit copying a FastRandomContext (move it, or create a new one to get reseeded). + FastRandomContext(const FastRandomContext&) = delete; + FastRandomContext(FastRandomContext&&) = delete; + FastRandomContext& operator=(const FastRandomContext&) = delete; + + /** Move a FastRandomContext. If the original one is used again, it will be reseeded. */ + FastRandomContext& operator=(FastRandomContext&& from) noexcept; + /** Generate a random 64-bit integer. */ uint64_t rand64() { |