2
0
mirror of synced 2025-01-12 17:44:08 +00:00
cs-codex-dist-tests/Utils/RandomUtils.cs
2023-06-21 10:06:54 +02:00

16 lines
393 B
C#

namespace Utils
{
public static class RandomUtils
{
private static readonly Random random = new Random();
public static T PickOneRandom<T>(this List<T> remainingItems)
{
var i = random.Next(0, remainingItems.Count);
var result = remainingItems[i];
remainingItems.RemoveAt(i);
return result;
}
}
}