forked from sage/MoonTools.ECS.Mirror
fix infinite loop if using EntitiesInRandomOrder with filter count 1
This commit is contained in:
parent
3e60d2dff2
commit
76b18a6ba9
|
@ -26,10 +26,14 @@ public static class RandomManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static LinearCongruentialEnumerator LinearCongruentialSequence(int n)
|
internal static LinearCongruentialEnumerator LinearCongruentialSequence(int n)
|
||||||
{
|
{
|
||||||
|
// special cases!
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
// bail out, empty enumerator
|
return new LinearCongruentialEnumerator(0, 1, 0);
|
||||||
return new LinearCongruentialEnumerator(0, 0, 0);
|
}
|
||||||
|
else if (n == 1)
|
||||||
|
{
|
||||||
|
return new LinearCongruentialEnumerator(0, 2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var x = Primes[Random.Next(Primes.Length - 1)];
|
var x = Primes[Random.Next(Primes.Length - 1)];
|
||||||
|
|
Loading…
Reference in New Issue