mirror of
https://github.com/codex-storage/cs-codex-dist-tests.git
synced 2025-02-02 23:33:45 +00:00
16 lines
393 B
C#
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;
|
|
}
|
|
}
|
|
}
|