I have a List
I would like to re-order it so so they are in random order.
What’s the quickest way to do this (by quickest, I mean least amount of code)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to randomly re-order in place you should shuffle the list, usage with an extension method is then a simple one-liner. This assumes you already have an
IListbased collection.Usage:
myList.Shuffle();Credit goes to this answer: Randomize a List<T>