Move LCRNG method to a random-based class

This commit is contained in:
Kurt
2015-06-16 21:18:06 -07:00
parent 26ef0ca80d
commit 5a37d25364
2 changed files with 12 additions and 11 deletions

View File

@@ -10,7 +10,7 @@ internal static int getRandomSpecies(ref int[] list, ref int ctr)
int species = list[ctr++]; ctr %= list.Length;
return species;
}
internal static readonly int[] RandomSpeciesList = Enumerable.Range(1, 721).Select(i => i).ToArray();
internal static readonly int[] RandomSpeciesList = Enumerable.Range(1, 721).ToArray();
internal static int[] getSpeciesList(bool G1, bool G2, bool G3, bool G4, bool G5, bool G6, bool L, bool E, bool Shedinja = true)
{
@@ -44,5 +44,15 @@ internal static int[] getSpeciesList(bool G1, bool G2, bool G3, bool G4, bool G5
return sL.Length == 0 ? RandomSpeciesList : sL;
}
public static uint LCRNG(uint seed, int ctr)
{
for (int i = 0; i < ctr; i++)
{
seed *= 0x41C64E6D;
seed += 0x00006073;
}
return seed;
}
}
}

View File

@@ -24,7 +24,7 @@ internal static Bitmap makeIMG(string path, bool save, int shift = 4, int s = 8)
c = Color.Black;
else
{
color = LCRNG(color, shift);
color = Randomizer.LCRNG(color, shift);
c = Color.FromArgb(0xFF, 0xFF - (byte)(color & 0xFF), 0xFF - (byte)((color >> 8) & 0xFF), 0xFF - (byte)(color >> 24 & 0xFF));
}
try
@@ -48,14 +48,5 @@ internal static Bitmap makeIMG(string path, bool save, int shift = 4, int s = 8)
return img;
}
}
public static uint LCRNG(uint seed, int ctr)
{
for (int i = 0; i < ctr; i++)
{
seed *= 0x41C64E6D;
seed += 0x00006073;
}
return seed;
}
}
}