public static IList<string> GetRandomNonRepeatingValues(IList<string> collection, int valuesCount, int defaultValueIndex = 0)
{
var indexes = new List<int>();
var collectionCount = collection.Count;
for (var i = 0; i < collectionCount; i++)
{
indexes.Add(i);
}
indexes.Shuffle();
var randomValues = new List<string>();
for (var i = 0; i < valuesCount; i++)
{
if (i >= collectionCount)
{
randomValues.Add(collection[defaultValueIndex]);
}
else
{
randomValues.Add(collection[indexes[i]]);
}
}
return randomValues;
}