Renci.SshNet.Abstractions.CryptoAbstraction.GenerateRandom C# (CSharp) Method

GenerateRandom() public static method

Fills an array of bytes with a cryptographically strong random sequence of values.
The length of the byte array determines how many random bytes are produced.
is null.
public static GenerateRandom ( byte data ) : void
data byte The array to fill with cryptographically strong random bytes.
return void
        public static void GenerateRandom(byte[] data)
        {
#if FEATURE_RNG_CREATE || FEATURE_RNG_CSP
            Randomizer.GetBytes(data);
#else
            if(data == null)
                throw new ArgumentNullException("data");

            var buffer = Windows.Security.Cryptography.CryptographicBuffer.GenerateRandom((uint) data.Length);
            System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeBufferExtensions.CopyTo(buffer, data);
#endif
        }