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

相关文章:

  • 2022-01-13
  • 2022-03-01
  • 2022-12-23
  • 2021-11-28
  • 2021-10-27
  • 2022-12-23
  • 2023-03-02
  • 2023-04-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
相关资源
相似解决方案