To generate Random numbers from 1- 20 I need to pick selective and it should not be repetitive.
How to do this in C#
Note I need to loop through as like this
I did one this way awhile back. I don't know how it compares to the other methods presented as far as efficiency, randomness, etc. But it seems to work:
List integers = new List() { 1, 2, 3, 4, 5, 6,7, 8, 9, 10, 11, 12 };
Random rnd = new Random();
var ints = from i in integers
orderby rnd.Next(integers.Count)
select i;