mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-29 15:56:05 +00:00
Make use of Random.Shared (#3852)
This commit is contained in:
parent
b96794e72b
commit
11aae9cfbc
|
@ -266,9 +266,8 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator
|
|||
// NOTE: Calls nn::friends::detail::service::core::PlayHistoryManager::GetInstance and stores the instance.
|
||||
|
||||
byte[] randomBytes = new byte[8];
|
||||
Random random = new Random();
|
||||
|
||||
random.NextBytes(randomBytes);
|
||||
Random.Shared.NextBytes(randomBytes);
|
||||
|
||||
// NOTE: Calls nn::friends::detail::service::core::UuidManager::GetInstance and stores the instance.
|
||||
// Then call nn::friends::detail::service::core::AccountStorageManager::GetInstance and store the instance.
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
|||
{
|
||||
byte[] uuid = new byte[9];
|
||||
|
||||
new Random().NextBytes(uuid);
|
||||
Random.Shared.NextBytes(uuid);
|
||||
|
||||
uuid[3] = (byte)(0x88 ^ uuid[0] ^ uuid[1] ^ uuid[2]);
|
||||
uuid[8] = (byte)(uuid[3] ^ uuid[4] ^ uuid[5] ^ uuid[6]);
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace Ryujinx.HLE.HOS.Services.Prepo
|
|||
{
|
||||
byte[] randomBuffer = new byte[8];
|
||||
|
||||
new Random().NextBytes(randomBuffer);
|
||||
Random.Shared.NextBytes(randomBuffer);
|
||||
|
||||
_systemSessionId = BitConverter.ToUInt64(randomBuffer, 0);
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ namespace Ryujinx.HLE.HOS.Services.Ro
|
|||
private KProcess _owner;
|
||||
private IVirtualMemoryManager _ownerMm;
|
||||
|
||||
private static Random _random = new Random();
|
||||
|
||||
public IRoInterface(ServiceCtx context)
|
||||
{
|
||||
_nrrInfos = new List<NrrInfo>(MaxNrr);
|
||||
|
@ -283,7 +281,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro
|
|||
{
|
||||
while (true)
|
||||
{
|
||||
ulong randomOffset = (ulong)(uint)_random.Next(0, (int)addressSpacePageLimit) << 12;
|
||||
ulong randomOffset = (ulong)(uint)Random.Shared.Next(0, (int)addressSpacePageLimit) << 12;
|
||||
|
||||
targetAddress = memMgr.GetAddrSpaceBaseAddr() + randomOffset;
|
||||
|
||||
|
|
Loading…
Reference in a new issue