Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Duende.​IdentityModel.​CryptoRandom
Assembly: Duende.IdentityModel
Inheritance: object → System.​Random → CryptoRandom
A class that mimics the standard Random class in the .NET Framework - but uses a random number generator internally.
Methods
public static
byte[]
CreateRandomKey​(int length)
Creates a random key byte array.
length
The length.
public
int
Next​()
Returns a nonnegative random number.
Returns A 32-bit signed integer greater than or equal to zero and less than <see cref="F:System.Int32.MaxValue" /> .
public
int
Next​(int maxValue)
Returns a nonnegative random number less than the specified maximum.
Returns A 32-bit signed integer greater than or equal to zero, and less than <paramref name="maxValue" /> ; that is, the range of return values ordinarily includes zero but not <paramref name="maxValue" /> . However, if <paramref name="maxValue" /> equals zero, <paramref name="maxValue" /> is returned.
maxValue
The exclusive upper bound of the random number to be generated. <paramref name="maxValue" /> must be greater than or equal to zero.
public
int
Next​(int minValue,
int maxValue)
Returns a random number within a specified range.
Returns A 32-bit signed integer greater than or equal to <paramref name="minValue" /> and less than <paramref name="maxValue" /> ; that is, the range of return values includes <paramref name="minValue" /> but not <paramref name="maxValue" /> . If <paramref name="minValue" /> equals <paramref name="maxValue" /> , <paramref name="minValue" /> is returned.
minValue
The inclusive lower bound of the random number returned.
maxValue
The exclusive upper bound of the random number returned. <paramref name="maxValue" /> must be greater than or equal to <paramref name="minValue" /> .
public
double
NextDouble​()
Returns a random number between 0.0 and 1.0.
Returns A double-precision floating point number greater than or equal to 0.0, and less than 1.0.
public
void
NextBytes​(byte[] buffer)
Fills the elements of a specified array of bytes with random numbers.
buffer
An array of bytes to contain random numbers.
public
string
GetHexString​(int stringLength,
bool lowercase = false)
Inherited from System.​Random
public
void
GetHexString​(System.​Span<​char> destination,
bool lowercase = false)
Inherited from System.​Random
public
T[]
GetItems​(System.​ReadOnlySpan<​T> choices,
int length)
Inherited from System.​Random
public
void
GetItems​(System.​ReadOnlySpan<​T> choices,
System.​Span<​T> destination)
Inherited from System.​Random
public
T[]
GetItems​(T[] choices,
int length)
Inherited from System.​Random
public
string
GetString​(System.​ReadOnlySpan<​char> choices,
int length)
Inherited from System.​Random
public
void
NextBytes​(System.​Span<​byte> buffer)
Inherited from System.​Random
public
long
NextInt64​(long minValue,
long maxValue)
Inherited from System.​Random
public
void
Shuffle​(System.​Span<​T> values)
Inherited from System.​Random
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object