use std-provided randomness for JitArm64 unittests

decreases runtime significantly and lessens dependency on mbedtls
This commit is contained in:
Shawn Hoffman
2023-02-22 12:55:12 -08:00
parent ebd98226db
commit 2c2fb869a2
3 changed files with 7 additions and 61 deletions

View File

@ -11,30 +11,6 @@
namespace Common::Random
{
/// Cryptographically secure pseudo-random number generator, with explicit seed.
class PRNG final
{
public:
explicit PRNG(u64 seed) : PRNG(&seed, sizeof(u64)) {}
PRNG(void* seed, std::size_t size);
~PRNG();
void Generate(void* buffer, std::size_t size);
template <typename T>
T GenerateValue()
{
static_assert(std::is_arithmetic<T>(), "T must be an arithmetic type in GenerateValue.");
T value;
Generate(&value, sizeof(value));
return value;
}
private:
struct Impl;
std::unique_ptr<Impl> m_impl;
};
/// Fill `buffer` with random bytes using a cryptographically secure pseudo-random number generator.
void Generate(void* buffer, std::size_t size);