[common] unify std::random_device (#3801)

Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3801
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2026-03-31 20:12:41 +02:00 committed by crueter
parent dd91b41a78
commit ee2891c55e
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
18 changed files with 85 additions and 66 deletions

19
src/common/random.cpp Normal file
View file

@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include <random>
#include "common/random.h"
static std::random_device g_random_device;
namespace Common::Random {
[[nodiscard]] u32 Random32(u32 seed) noexcept {
return g_random_device();
}
[[nodiscard]] u64 Random64(u64 seed) noexcept {
return g_random_device();
}
[[nodiscard]] std::mt19937 GetMT19937() noexcept {
return std::mt19937(g_random_device());
}
}