Suppose the possible outcome of an abandoned stamp is one of {1,2,3,4,5,6}
When two bones are selected three times , I want to collect random results from two bones.
My implementation
var q = from threeTimes in new int[] { 1, 2, 3 }
let set1 = new Random().Next(1, 6)
let set2 = new Random().Next(1, 6)
select new { s1 = set1, s2 = set2 };
foreach (var v in q)
{
Console.WriteLine("Die1 :{0} Die2 :{1}", v.s1, v.s2);
}
But most of the time I get the same values ββfor Die1 and Die2.
I mean
Die1: 5 Die2: 5
Die1: 2 Die2: 2
Die1: 2 Die2: 2
What correction do I need to make in order to get random pairs?
source
share