Skip to content

Instantly share code, notes, and snippets.



Last active May 28, 2017
What would you like to do?
public static class StaticRandom
private static int seed;
private static ThreadLocal<Random> threadLocal = new ThreadLocal<Random>
(() => new Random(Interlocked.Increment(ref seed)));
static StaticRandom()
seed = Environment.TickCount;
public static Random Instance { get { return threadLocal.Value; } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment