diff --git a/src/Mono.cs b/src/Mono.cs index 968971c..ddf72ca 100644 --- a/src/Mono.cs +++ b/src/Mono.cs @@ -248,6 +248,23 @@ static class Mono } } + static int[] GetShuffledIndices(T[] array) + { + int[] indices = new int[array.Length]; + for (int i = 0; i < array.Length; i++) + { + indices[i] = i; + } + for (int i = indices.Length - 1; i > 0; i--) + { + int j = System.Random.Shared.Next(i + 1); + int temp = indices[i]; + indices[i] = indices[j]; + indices[j] = temp; + } + return indices; + } + // directions for moving in the grid static readonly XYZi[] directions = new XYZi[] {