diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 14a9602d6..39cf09dd9 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -772,7 +772,8 @@ public void setShinyPID() public void setShinySID() { if (IsShiny) return; - do SID = Util.rnd16(); while (!IsShiny); + var xor = TID ^ (PID >> 16) ^ (PID & 0xFFFF); + SID = (int)((xor & 0xFFF8) | (Util.rnd32() & 7)); } /// /// Applies a PID to the according to the specified . diff --git a/PKHeX.Core/Util/RandUtil.cs b/PKHeX.Core/Util/RandUtil.cs index 9ca17f4b3..d638b1bc6 100644 --- a/PKHeX.Core/Util/RandUtil.cs +++ b/PKHeX.Core/Util/RandUtil.cs @@ -9,10 +9,6 @@ public static uint rnd32() { return (uint)rand.Next(1 << 30) << 2 | (uint)rand.Next(1 << 2); } - internal static ushort rnd16() - { - return (ushort)rand.Next(ushort.MaxValue); - } public static void Shuffle(T[] array) { int n = array.Length; diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index 8d09b6d14..5c2617f75 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -1487,7 +1487,7 @@ private void updateShiny(bool PID) if (pkm.Format > 2) { - if(PID) + if (PID) { pkm.setShinyPID(); TB_PID.Text = pkm.PID.ToString("X8");