LibJS/LibCrypto: Cleanup JS Math random() RNG

This commit adds a convenience method to secure random for initializing
single types. It changes the random number generator in JS math random()
to use newer constants by the author as well as initializes it with a
higher quality seed.
This commit is contained in:
R-Goc 2025-04-11 22:12:04 +02:00 committed by Andrew Kaster
commit d60543c2cb
Notes: github-actions[bot] 2025-05-15 13:42:08 +00:00
2 changed files with 19 additions and 6 deletions

View file

@ -12,4 +12,12 @@ namespace Crypto {
void fill_with_secure_random(Bytes);
template<typename T>
inline T get_secure_random()
{
T t;
fill_with_secure_random({ &t, sizeof(T) });
return t;
}
}