mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
20 lines
448 B
C#
20 lines
448 B
C#
using System.Collections.Generic;
|
|
|
|
namespace Obfuz.Utils
|
|
{
|
|
static class RandomUtil
|
|
{
|
|
public static void ShuffleList<T>(List<T> list, IRandom random)
|
|
{
|
|
int n = list.Count;
|
|
for (int i = n - 1; i > 0; i--)
|
|
{
|
|
int j = random.NextInt(i + 1);
|
|
T temp = list[i];
|
|
list[i] = list[j];
|
|
list[j] = temp;
|
|
}
|
|
}
|
|
}
|
|
}
|