public static string RandomString(int lenght) { string str = string.Empty; for (int i = 1; i <= lenght; i++) { int randomInt = Randomizer.Next(0, Hash.Length); str += Hash[randomInt]; } return(str); }
public static T[] Random <T>(this IEnumerable <T> enumerable, int count) { T[] array = new T[count]; int lenght = enumerable.Count(); if (lenght <= 0) { return(new T[0]); } var random = new AsyncRandom(); for (int i = 0; i < count; i++) { array[i] = enumerable.ElementAt(random.Next(lenght)); } return(array); }