Class ThreadRandom
- Namespace
- ONITwitchLib
- Assembly
- ONITwitchLib.dll
A Random that is safe to use from any thread.
public static class ThreadRandom- Inheritance
- 
      
      ThreadRandom
- Inherited Members
Methods
Next()
Returns a non-negative random integer.
public static int Next()Returns
Next(int)
Returns a non-negative random integer that is less than the specified maximum.
public static int Next(int maxValue)Parameters
- maxValueint
- The exclusive upper bound of the random number to be generated. - maxValuemust be greater than or equal to 0.
Returns
- int
- A 32-bit signed integer that is greater than or equal to 0, and less than - maxValue; that is, the range of return values ordinarily includes 0 but not- maxValue. However, if- maxValueequals 0,- maxValueis returned.
Exceptions
- ArgumentOutOfRangeException
- maxValueis less than 0.
Next(int, int)
Returns a random integer that is within a specified range.
public static int Next(int minValue, int maxValue)Parameters
- minValueint
- The inclusive lower bound of the random number returned. 
- maxValueint
- The exclusive upper bound of the random number returned. - maxValuemust be greater than or equal to- minValue.
Returns
- int
- A 32-bit signed integer greater than or equal to - minValueand less than- maxValue; that is, the range of return values includes- minValuebut not- maxValue. If- minValueequals- maxValue,- minValueis returned.
Exceptions
- ArgumentOutOfRangeException
- minValueis greater than- maxValue.
NextBytes(byte[])
Fills the elements of a specified array of bytes with random numbers.
public static void NextBytes(byte[] buffer)Parameters
- bufferbyte[]
- An array of bytes to contain random numbers. 
Exceptions
- ArgumentNullException
- bufferis null.
NextDouble()
Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0.
public static double NextDouble()Returns
- double
- A double-precision floating point number that is greater than or equal to 0.0, and less than 1.0.