Mega Code Archive

 
Categories / C# Tutorial / Security
 

Cryptographically sound random numbers

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