Use PCGRandom instead of System.Random, documentation
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentResults" Version="3.16.0" />
|
||||
<PackageReference Include="PcgRandom" Version="1.2.0" />
|
||||
<PackageReference Include="PolySharp" Version="1.14.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Pcg;
|
||||
|
||||
namespace PkmnLib.Static.Utils;
|
||||
|
||||
/// <summary>
|
||||
@@ -49,30 +51,30 @@ public interface IRandom
|
||||
/// <inheritdoc />
|
||||
public class RandomImpl : IRandom
|
||||
{
|
||||
private readonly Random _random;
|
||||
private readonly PcgRandom _random;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance that uses the given <see cref="Random"/> instance as its source of randomness.
|
||||
/// Creates a new instance that uses the given <see cref="PcgRandom"/> instance as its source of randomness.
|
||||
/// </summary>
|
||||
public RandomImpl(Random random)
|
||||
public RandomImpl(PcgRandom random)
|
||||
{
|
||||
_random = random;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance that uses the given seed to create a new <see cref="Random"/> instance.
|
||||
/// Creates a new instance that uses the given seed to create a new <see cref="PcgRandom"/> instance.
|
||||
/// </summary>
|
||||
public RandomImpl(int seed)
|
||||
{
|
||||
_random = new Random(seed);
|
||||
_random = new PcgRandom(seed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance that uses a new <see cref="Random"/> instance.
|
||||
/// Creates a new instance that uses a new <see cref="PcgRandom"/> instance.
|
||||
/// </summary>
|
||||
public RandomImpl()
|
||||
{
|
||||
_random = new Random();
|
||||
_random = new PcgRandom();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user