diff --git a/isometric-park-fna/Utils/Extensions.cs b/isometric-park-fna/Utils/Extensions.cs new file mode 100644 --- /dev/null +++ b/isometric-park-fna/Utils/Extensions.cs @@ -0,0 +1,26 @@ + +using System; +using System.Collections.Generic; + + +namespace isometricparkfna +{ + public static class Extensions + { + public static List Shuffle (this List source) { + Random rnd = new Random(); + + for(int i = (source.Count-1); i >= 0 ; i--) { + var j = rnd.Next(0, (source.Count-1)); + var tmp = source[j]; + source[j] = source[i]; + source[i] = tmp; + } + + + return source; + + } + } +} +