O
Oleg Subachev
I expected that the following code:
Random RND = new Random();
var S = Enumerable.Range( 1, 2 ).Select( i => RND.NextDouble() );
foreach ( var V in S )
Console.WriteLine( V );
Console.WriteLine();
foreach ( var V in S )
Console.WriteLine( V );
prints the same sets of doubles.
But the sets are different.
In my case:
0,305861282770457
0,0789059219318004
0,828014308040968
0,46924011291435
Why S does not keep the values between foreach calls ?
Oleg Subachev
Random RND = new Random();
var S = Enumerable.Range( 1, 2 ).Select( i => RND.NextDouble() );
foreach ( var V in S )
Console.WriteLine( V );
Console.WriteLine();
foreach ( var V in S )
Console.WriteLine( V );
prints the same sets of doubles.
But the sets are different.
In my case:
0,305861282770457
0,0789059219318004
0,828014308040968
0,46924011291435
Why S does not keep the values between foreach calls ?
Oleg Subachev