Click here to Skip to main content
15,888,351 members
Articles / Programming Languages / C#

How to generate many random various numbers?

Rate me:
Please Sign up or sign in to vote.
4.27/5 (9 votes)
9 Sep 2011CPOL 15.9K   2  
Use LINQ:public IEnumerable GenerateRandomSequence(int min, int max){ var rnd = new Random(); return Enumerable.Range( min, max-min ).OrderBy( n => rnd.Next() );}You'll need a reference to System.Core to use this, and a version of .NET that supports LINQ.If you're using...

Views

Daily Counts

License

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


Written By
Software Developer (Senior) Woodland Furniture
United States United States
Started programming on a Commodore Vic-20 at 6 years old. Never really stopped since then. Fluent in x86 Assembly, C++ (ATL & MFC), C# (ASP.NET/WF/WPF/Silverlight), HTML, & Javascript. Really excited at the fast pace at which new technology is released.

Comments and Discussions