mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Testing out RandN for better quality random. Also took out seeds until I can find a way to implement it that doesn't completely break gambling
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="NLog" Version="6.0.4" />
|
<PackageReference Include="NLog" Version="6.0.4" />
|
||||||
<PackageReference Include="Raffinert.FuzzySharp" Version="3.0.6" />
|
<PackageReference Include="Raffinert.FuzzySharp" Version="3.0.6" />
|
||||||
|
<PackageReference Include="RandN" Version="0.5.0" />
|
||||||
<PackageReference Include="System.Runtime.Caching" Version="9.0.9" />
|
<PackageReference Include="System.Runtime.Caching" Version="9.0.9" />
|
||||||
<PackageReference Include="System.Text.Json" Version="9.0.9" />
|
<PackageReference Include="System.Text.Json" Version="9.0.9" />
|
||||||
<PackageReference Include="Websocket.Client" Version="5.3.0" />
|
<PackageReference Include="Websocket.Client" Version="5.3.0" />
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ using KfChatDotNetBot.Settings;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using RandN;
|
||||||
|
using RandN.Compat;
|
||||||
|
using RandN.Rngs;
|
||||||
|
|
||||||
namespace KfChatDotNetBot.Services;
|
namespace KfChatDotNetBot.Services;
|
||||||
|
|
||||||
@@ -423,7 +426,8 @@ public static class Money
|
|||||||
public static int GetRandomNumber(GamblerDbModel gambler, int min, int max, int iterations = 10,
|
public static int GetRandomNumber(GamblerDbModel gambler, int min, int max, int iterations = 10,
|
||||||
bool incrementMaxParam = true)
|
bool incrementMaxParam = true)
|
||||||
{
|
{
|
||||||
var random = new Random(gambler.RandomSeed.GetHashCode());
|
var rng = StandardRng.Create();
|
||||||
|
var random = RandomShim.Create(rng);
|
||||||
var result = 0;
|
var result = 0;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
if (incrementMaxParam) max++;
|
if (incrementMaxParam) max++;
|
||||||
|
|||||||
Reference in New Issue
Block a user