PKHeX/PKHeX.Core/Util/RandUtil.cs
Kurt 2c541ad422
Update to .NET 10 (#4676)
* Update to .NET 10
* Property fields
* API signature updates
* Extension method blocks

* Completed dark mode support
  Outside of my control:
- vertical tab control (pkm editor)
- datetimepicker controls
- lgpe event flags (no idea)
- some control types having white-borders when they should really be gray

Box background is 50% transparency to effectively darken the image.

* Custom legality report popup
* Event diff dialog, version select dialog
* Add quick overwrite popup for export sav
* Extension methods
* Dark Mode: glow currently editing sprite
* Add invalid encounter hint for trade evolutions
* Extension properties
* Append legality hint on hover card
* Slot image loading: clear the screen-reader description if a slot is empty/invalid, rather than retain the previous description. Changing boxes would easily confuse users on this.
2025-12-31 01:42:05 -06:00

33 lines
1.2 KiB
C#

using System;
namespace PKHeX.Core;
public static partial class Util
{
/// <inheritdoc cref="Random.Shared"/>
public static Random Rand => Random.Shared;
/// <inheritdoc cref="Rand32(Random)"/>
/// <remarks>Uses <see cref="Random.Shared"/> to generate the random number.</remarks>
public static uint Rand32() => Rand.Rand32();
extension(Random rnd)
{
/// <summary>
/// Generates a random 32-bit unsigned integer.
/// </summary>
/// <returns>A random 32-bit unsigned integer.</returns>
public uint Rand32() => (uint)rnd.NextInt64();
/// <summary>
/// Generates a 64-bit unsigned random number by combining two 32-bit random values.
/// </summary>
/// <remarks>
/// This method extends the <see cref="Random"/> class to provide a 64-bit random number by combining the results of two 32-bit random number generations.
/// The lower 32 bits are derived from one call to <c>Rand32</c>, and the upper 32 bits are derived from another call.
/// </remarks>
/// <returns>A 64-bit unsigned integer representing the combined random value.</returns>
public ulong Rand64() => rnd.Rand32() | ((ulong)rnd.Rand32() << 32);
}
}