Cryptographically sound random numbers : RandomNumberGenerator « Security « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;


public class MainClass
{
    public static void Main()
    {
        RandomNumberGenerator rng = RandomNumberGenerator.Create();
        byte[] b = new byte[1];
        rng.GetBytes(b);
        Console.WriteLine(b[0]);
    }
}
191








35.8.RandomNumberGenerator
35.8.1.Generate 32 bytes of random data
35.8.2.Cryptographically sound random numbers