using System.Collections.Generic;
using System;

namespace YBEE.EQM.Core;

/// <summary>
/// 工具类型
/// </summary>
public static class Utils
{
    /// <summary>
    /// List随机乱序
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="sources"></param>
    public static void ListRandom<T>(List<T> sources)
    {
        Random rd = new();
        int index;
        T temp;
        for (int i = 0; i < sources.Count; i++)
        {
            index = rd.Next(0, sources.Count - 1);
            if (index != i)
            {
                temp = sources[i];
                sources[i] = sources[index];
                sources[index] = temp;
            }
        }
    }
}
