wave behavior and fixed explosion
This commit is contained in:
19
tools/IterableUtils.cs
Normal file
19
tools/IterableUtils.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Movementtests.tools;
|
||||
|
||||
public static class IterableUtils
|
||||
{
|
||||
private static readonly Random Rng = new Random();
|
||||
|
||||
public static void Shuffle<T>(this IList<T> list)
|
||||
{
|
||||
var n = list.Count;
|
||||
while (n > 1) {
|
||||
n--;
|
||||
var k = Rng.Next(n + 1);
|
||||
(list[k], list[n]) = (list[n], list[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user