Click here to Skip to main content
15,400,433 members
Articles / Programming Languages / C#

Tagged as

Stats

8.8K views
1 bookmarked

Let's randomize IEnumerable

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
12 Oct 2011CPOL
Shuffle in O(N) time, vastly faster than the original version that calls RemoveAt().static Random r = new Random();public static IEnumerable Randomize(this IEnumerable source){ var list = source.ToList(); for (int i = 0; i < list.Count; i++) Swap(list, i,...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Qwertie
Software Developer None
Canada Canada
Since I started programming when I was 11, I wrote the SNES emulator "SNEqr", the FastNav mapping component, the Enhanced C# programming language (in progress), the parser generator LLLPG, and LES, a syntax to help you start building programming languages, DSLs or build systems.

My overall focus is on the Language of your choice (Loyc) initiative, which is about investigating ways to improve interoperability between programming languages and putting more power in the hands of developers. I'm also seeking employment.

Comments and Discussions