Ive taken over some prize drawing code.
I can see the person is using a Random number to order them by but is this actually going to be random as i cant see any place where he has done oRand.Next(); Does the default Random generate an actual random number.
Random oRand = new Random();
var res = (from l in listNew.AsQueryable<Participant>() //entities.Participant
where l.Status != 0
select l).AsEnumerable().OrderBy(p=>oRand);
In the example code you are ordering by the “RandomNumberMaker” (i.e. the same value for all values), not by random numbers.
This is quickly tested by comparing this code in LINQPad (which yields the numbers 1 to 1000 in natural order).
with this code (which orders the numbers 1 to 1000 in pseudorandom order):
For an intro to how random .NET random really is, check out this article which has the advantage of starting with this great comic:
(source: csharpcity.com)