private static int seed = 13; private static ThreadLocal<Random> threadLocal = new ThreadLocal<Random>(() => new Random(Interlocked.Increment(ref seed))); --用法 TxID = threadLocal.Value.Next();
转发自:https://www.cnblogs.com/gt1987/p/14034660.html