diff --git a/src/Nadeko.Common/NadekoRandom.cs b/src/Nadeko.Common/NadekoRandom.cs index af56269ec..da7688824 100644 --- a/src/Nadeko.Common/NadekoRandom.cs +++ b/src/Nadeko.Common/NadekoRandom.cs @@ -25,20 +25,6 @@ public class NadekoRandom : Random _rng.GetBytes(bytes); return Math.Abs(BitConverter.ToInt32(bytes, 0)) % maxValue; } - - public byte Next(byte minValue, byte maxValue) - { - if (minValue > maxValue) - throw new ArgumentOutOfRangeException(nameof(maxValue)); - - if (minValue == maxValue) - return minValue; - - var bytes = new byte[1]; - _rng.GetBytes(bytes); - - return (byte)((bytes[0] % (maxValue - minValue)) + minValue); - } public override int Next(int minValue, int maxValue) { diff --git a/src/Nadeko.Econ/Gambling/Betflip/BetflipGame.cs b/src/Nadeko.Econ/Gambling/Betflip/BetflipGame.cs index 7aad2db55..a48f38549 100644 --- a/src/Nadeko.Econ/Gambling/Betflip/BetflipGame.cs +++ b/src/Nadeko.Econ/Gambling/Betflip/BetflipGame.cs @@ -12,7 +12,7 @@ public sealed class BetflipGame public BetflipResult Flip(byte guess, decimal amount) { - var side = _rng.Next(0, 2); + var side = (byte)_rng.Next(0, 2); if (side == guess) { return new BetflipResult() diff --git a/src/Nadeko.Econ/Gambling/Betroll/BetrollGame.cs b/src/Nadeko.Econ/Gambling/Betroll/BetrollGame.cs index dc8b17c26..4ad027276 100644 --- a/src/Nadeko.Econ/Gambling/Betroll/BetrollGame.cs +++ b/src/Nadeko.Econ/Gambling/Betroll/BetrollGame.cs @@ -13,7 +13,7 @@ public sealed class BetrollGame public BetrollResult Roll(decimal amount = 0) { - var roll = _rng.Next(0, 101); + var roll = _rng.Next(1, 101); for (var i = 0; i < _thresholdPairs.Length; i++) { diff --git a/src/Nadeko.Econ/Gambling/Slot/SlotGame.cs b/src/Nadeko.Econ/Gambling/Slot/SlotGame.cs index 8d64c51a1..b10d7154f 100644 --- a/src/Nadeko.Econ/Gambling/Slot/SlotGame.cs +++ b/src/Nadeko.Econ/Gambling/Slot/SlotGame.cs @@ -8,9 +8,9 @@ public class SlotGame { var rolls = new[] { - _rng.Next(0, 6), - _rng.Next(0, 6), - _rng.Next(0, 6) + (byte)_rng.Next(0, 6), + (byte)_rng.Next(0, 6), + (byte)_rng.Next(0, 6) }; ref var a = ref rolls[0]; diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index 20f1d4e61..8b3c2cf68 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -875,11 +875,12 @@ public partial class Gambling : GamblingModule public enum GambleTestTarget { Slot, + Betroll, + Betflip, + BetflipT, BetDraw, BetDrawHL, BetDrawRB, - Betflip, - BetflipT, Lula, Rps, } @@ -920,6 +921,7 @@ public partial class Gambling : GamblingModule GambleTestTarget.BetflipT => (await _gs.BetFlipAsync(ctx.User.Id, 0, 1)).AsT0.Multiplier, GambleTestTarget.Lula => (await _gs.LulaAsync(ctx.User.Id, 0)).AsT0.Multiplier, GambleTestTarget.Rps => (await _gs.RpsAsync(ctx.User.Id, 0, (byte)(i % 3))).AsT0.Multiplier, + GambleTestTarget.Betroll => (await _gs.BetRollAsync(ctx.User.Id, 0)).AsT0.Multiplier, _ => throw new ArgumentOutOfRangeException(nameof(target)) };