The question is:
select a random assortment of items [from a collection], the number of which being left up to the user
The idiomatic way to do this is to do a proper shuffle of the source collection, then take the first N items. A bad way (in terms of both performance and randomness) to shuffle a list is to order by Random.Next()
or Guid.NewGuid()
.
Despite the title of the question, what is being asked here is definitely not "Can the Random class return strings?". Answering that question is feeding into an XY problem, without showing understanding to the OP's underlying problem, which is explained in their question text.
Now as for the actual duplicate, in hindsight (and with the motivation shown above) I agree the question I chose (Access random item in list) was not the best target. The second answer does exactly what the OP asks for, but with an improper implementation. I get trigger-happy with duplicate-votes on questions that show little research effort, and am aware of that.
But just as security ("I can't read the result, so it must be properly encrypted, amirite?"), random is a poorly understood subject. "The result isn't ordered like it was at the start, so it must be random, right?", so you cannot trust the upvotes on the answers that do contain code.
The question Select N random elements from a List<T> in C# is also a poor duplicate. The first few answers contain theoretical discussions and/or poor implementations, only the seventh answer contains actual, non-broken code.
Given a list of length n select k random elements using C# is a good duplicate. Randomize a List<T> too, but only answers the question at hand partially.
Can Random pick a random assortment of, strings or char's?
Because that's basically all they have asked with quite a bit of noise round it.