Appearance
RandomStatic Class
Definition
Provides a thread safe wrapper to the Random class Use of the class in CRYPTOGRAPHIC routines is NOT recommended
- Namespace:
JASE - Assembly:
JASE.Primitives.dll
Methods
| Name | Description |
|---|---|
bool GetBool(double trueChance = null) | Returns true with the specified chance (percentage from 0 to 100). Defaults to 50% (coin flip). Values less than or equal to 0 return false Values greater than or equal to 100 return true |
int Next() | Returns a nonnegative random number. |
int Next(int max) | Returns a nonnegative random number less than the specified maximum. |
int Next(int min, int max) | Returns a random number within a specified range. |
byte[] NextBytes(int count) | Returns a new array of the specified length filled with random bytes. |
void NextBytes(Span<byte> buffer) | Fills the elements of a specified array of bytes with random numbers. |
void NextBytes(byte[] buffer) | Fills the elements of a specified array of bytes with random numbers. |
double NextDouble() | Returns a random number between 0.0 and 1.0. |
long NextInt64() | Returns a nonnegative random number. |
long NextInt64(long max) | Returns a nonnegative random number. |
long NextInt64(long min, long max) | Returns a nonnegative random number. |
float NextSingle() | Returns a random floating point number between 0.0 and 1.0. |
int SeededNext(int seed, int max) | Returns a nonnegative random number. |
int SeededNext(int seed, int min, int max) | Returns a random number within a specified range. |
int SeededNext(long seed, int max) | Returns a nonnegative random number. |
int SeededNext(long seed, int min, int max) | Returns a random number within a specified range. |