Merge pull request #4835 from lat9nq/rng-default-time

kernel: Use the current time as the default RNG seed
This commit is contained in:
bunnei 2020-10-28 22:51:29 -07:00 committed by GitHub
commit c5134cbf3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,7 +123,7 @@ std::shared_ptr<Process> Process::Create(Core::System& system, std::string name,
: kernel.CreateNewUserProcessID(); : kernel.CreateNewUserProcessID();
process->capabilities.InitializeForMetadatalessProcess(); process->capabilities.InitializeForMetadatalessProcess();
std::mt19937 rng(Settings::values.rng_seed.GetValue().value_or(0)); std::mt19937 rng(Settings::values.rng_seed.GetValue().value_or(std::time(nullptr)));
std::uniform_int_distribution<u64> distribution; std::uniform_int_distribution<u64> distribution;
std::generate(process->random_entropy.begin(), process->random_entropy.end(), std::generate(process->random_entropy.begin(), process->random_entropy.end(),
[&] { return distribution(rng); }); [&] { return distribution(rng); });