Dev #13
@@ -125,7 +125,7 @@ namespace GameDevLibrary.Extensions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="list"></param>
|
/// <param name="list"></param>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public static void Shuffle<T>(this IList<T> list)
|
public static IList<T> Shuffle<T>(this IList<T> list)
|
||||||
{
|
{
|
||||||
RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
|
RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
|
||||||
int n = list.Count;
|
int n = list.Count;
|
||||||
@@ -138,6 +138,8 @@ namespace GameDevLibrary.Extensions
|
|||||||
n--;
|
n--;
|
||||||
(list[k], list[n]) = (list[n], list[k]);
|
(list[k], list[n]) = (list[n], list[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user