Add FastRandomContext::rand256() and ::randbytes()

FastRandomContext now provides all functionality that the real Rand* functions
provide.
This commit is contained in:
Pieter Wuille
2017-05-02 11:04:31 -07:00
parent 9fec4da0be
commit 37e864eb9f
3 changed files with 33 additions and 0 deletions

View File

@@ -110,9 +110,15 @@ public:
}
}
/** Generate random bytes. */
std::vector<unsigned char> randbytes(size_t len);
/** Generate a random 32-bit integer. */
uint32_t rand32() { return randbits(32); }
/** generate a random uint256. */
uint256 rand256();
/** Generate a random boolean. */
bool randbool() { return randbits(1); }
};