Cryptographically sound random numbers : RandomNumberGenerator : Security C# Examples


C# Examples » Security » RandomNumberGenerator »

 

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]);
        }
}
    
   
  
   



Output

191


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Security
» RandomNumberGenerator