Explain about piece of code in C# - Random Numbers

  • Thread starter Thread starter Arash_89
  • Start date Start date
A

Arash_89

Guest
Hello,

I would generate a sequence between 1 and 49, shuffle them and pick 6 number out of the sequence.

But could you please more explain about

OrderBy(x => rnd.Next())


in

var rnd = new Random();
var randomNumbers = Enumerable.Range(1,49).OrderBy(x => rnd.Next()).Take(20).ToList();


I'm confused how this code works. OrderBy(x => rnd.Next())

Thanks

Continue reading...
 
Back
Top