Class ThreadLocalRandom
System.Random is not thread safe. This is a thread safe version random based on https://devblogs.microsoft.com/pfxteam/getting-random-numbers-in-a-thread-safe-way/.
Inheritance
System.Object
ThreadLocalRandom
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Nier.Commons
Assembly: cs.temp.dll.dll
Syntax
public class ThreadLocalRandom : IRandom
Fields
Instance
Singleton instance.
Declaration
public static readonly ThreadLocalRandom Instance
Field Value
Type | Description |
---|---|
ThreadLocalRandom |
Methods
Next()
Declaration
public int Next()
Returns
Type | Description |
---|---|
System.Int32 |
Next(Int32)
Declaration
public int Next(int maxValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maxValue |
Returns
Type | Description |
---|---|
System.Int32 |
Next(Int32, Int32)
Declaration
public int Next(int minValue, int maxValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | minValue | |
System.Int32 | maxValue |
Returns
Type | Description |
---|---|
System.Int32 |
NextBytes(Byte[])
Declaration
public void NextBytes(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer |
NextDouble()
Declaration
public double NextDouble()
Returns
Type | Description |
---|---|
System.Double |