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
rngRandomNumberGeneratorThe System.Security.Cryptography.RandomNumberGenerator instance being extended.
dataSpan<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
rngRandomNumberGeneratorThe System.Security.Cryptography.RandomNumberGenerator instance being extended.
fromInclusiveintThe lowest value of the range.
toExclusiveintOne 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
rngRandomNumberGeneratorThe System.Security.Cryptography.RandomNumberGenerator instance being extended.
fromInclusiveintThe lowest value of the range.
toExclusiveintOne above the highest value of the range.
Returns
- int
Random
Int32.