What is the best way to grab n items from an IEnumerable<T> in random order?
I'm writing a store API and need to provide a small set of random items from a sometimes huge enumeration of items. The underlying enumerable is sometimes an array, and sometimes a lazy evaluated filter of said array.
Since I'm just grabbing a proportionally small number of items from the enumerations, it is better to use some sort of repeatedly random index into the enumeration and dupe check every time rather than randomly sort the entire list using an existing algorithm and grab top x, right?
Any better ideas?