Random , . , ; Random , . :
.
RandomGen2 Microsoft ParallelFX ( , ), ( ) .
public static class RandomGen2
{
private static Random _global = new Random();
[ThreadStatic]
private static Random _local;
public static int Next()
{
Random inst = _local;
if (inst == null)
{
int seed;
lock (_global) seed = _global.Next();
_local = inst = new Random(seed);
}
return inst.Next();
}
}
:
var rand = RandomGen2.Next();
Random, , , ThreadSafeRandom, .