<PackageReference Include="BouncyCastle.Cryptography" Version="2.5.0" />

Org.BouncyCastle.Security.SecureRandom

public class SecureRandom : Random
namespace Org.BouncyCastle.Security { public class SecureRandom : Random { protected readonly IRandomGenerator generator; public static byte[] GetNextBytes(SecureRandom secureRandom, int length); public static SecureRandom GetInstance(string algorithm); public static SecureRandom GetInstance(string algorithm, bool autoSeed); public SecureRandom(); public SecureRandom(IRandomGenerator generator); public SecureRandom(IRandomGenerator generator, int autoSeedLengthInBytes); public virtual byte[] GenerateSeed(int length); public virtual void SetSeed(byte[] seed); public virtual void SetSeed(long seed); public virtual void NextBytes(byte[] buf, int off, int len); public virtual int NextInt(); public virtual long NextLong(); } }