Class RandomNumberGeneratorExt
- Namespace
- Yubico.YubiKey.Cryptography
- Assembly
- Yubico.YubiKey.dll
Extension class to extend random number functionality.
public static class RandomNumberGeneratorExt
- Inheritance
-
objectRandomNumberGeneratorExt
Methods
Fill(RandomNumberGenerator, Span<byte>)
Fill a range with random bytes.
public static void Fill(this RandomNumberGenerator rng, Span<byte> data)
Parameters
rng
RandomNumberGeneratorThe System.Security.Cryptography.RandomNumberGenerator instance being extended.
data
Span<byte>A System.Span<T> to fill with random bytes.
GetByte(RandomNumberGenerator, int, int)
Get a byte with a random value.
public static byte GetByte(this RandomNumberGenerator rng, int fromInclusive, int toExclusive)
Parameters
rng
RandomNumberGeneratorThe System.Security.Cryptography.RandomNumberGenerator instance being extended.
fromInclusive
intThe lowest value of the range.
toExclusive
intOne above the highest value of the range.
Returns
- byte
GetInt32(RandomNumberGenerator, int, int)
Gets a random 32-bit signed int.
public static int GetInt32(this RandomNumberGenerator rng, int fromInclusive, int toExclusive)
Parameters
rng
RandomNumberGeneratorThe System.Security.Cryptography.RandomNumberGenerator instance being extended.
fromInclusive
intThe lowest value of the range.
toExclusive
intOne above the highest value of the range.
Returns
- int
Random
Int32
.