using System.Threading;
namespace System
{
///
/// 线程私有random对象
///
[UnityEngine.Scripting.Preserve]
public static class ThreadLocalRandom
{
private static int _seed = Environment.TickCount;
private static readonly ThreadLocal _rng = new ThreadLocal(() => new Random(Interlocked.Increment(ref _seed)));
///
/// The current random number seed available to this thread
///
public static Random Current
{
get { return _rng.Value; }
}
}
}