Last active
September 28, 2017 17:24
-
-
Save patbonecrusher/6039477 to your computer and use it in GitHub Desktop.
Generating a sequence of unique random numbers in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Random rnd = new Random(); | |
var randomNumbers = Enumerable.Range(1, 100) | |
.Select(x => new { val = x, order = rnd.Next() }) | |
.OrderBy(i => i.order) | |
.Select(x => x.val) | |
.ToArray(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment