mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-02 08:49:18 +00:00
d47bb1d297
With the new version of Visual Studio bringing C# 12, we can revise our logic for better readability as well as use new methods/APIs introduced in the .NET 8.0 BCL.
12 lines
375 B
C#
12 lines
375 B
C#
using System;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public static partial class Util
|
|
{
|
|
public static Random Rand => Random.Shared;
|
|
|
|
public static uint Rand32() => Rand32(Rand);
|
|
public static uint Rand32(this Random rnd) => ((uint)rnd.Next(1 << 30) << 2) | (uint)rnd.Next(1 << 2);
|
|
public static ulong Rand64(this Random rnd) => rnd.Rand32() | ((ulong)rnd.Rand32() << 32);
|
|
}
|