refactoring

This commit is contained in:
Michele Scandura 2020-11-05 20:03:01 +00:00
parent c293490995
commit 4dfbcff460
14 changed files with 240 additions and 82 deletions

View file

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
namespace SignalRChat.Hubs
{
public static class ExtensionMethods
{
private static Random rng = new Random();
public static void Shuffle<T>(this IList<T> list)
{
int n = list.Count;
while (n > 1)
{
n--;
int k = rng.Next(n + 1);
T value = list[k];
list[k] = list[n];
list[n] = value;
}
}
}
}