RandomNumberGenerator.Create() : RandomNumberGenerator « System.Security.Cryptography « C# / C Sharp by API






RandomNumberGenerator.Create()

  
using System;
using System.Security.Cryptography;

class MainClass {
    public static void Main() {
        byte[] number = new byte[32];
        RandomNumberGenerator rng = RandomNumberGenerator.Create();
        rng.GetBytes(number);

        Console.WriteLine(BitConverter.ToString(number));

    }
}

   
    
  








Related examples in the same category

1.RandomNumberGenerator.GetBytes