Do not permit copying FastRandomContexts

This commit is contained in:
Pieter Wuille
2018-10-31 15:41:13 -07:00
parent 022cf47dd7
commit e414486d56
2 changed files with 22 additions and 0 deletions

View File

@@ -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()
{