Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

C# Truly Random

      
            
                
            
 run  | edit  | history  | help 1

Interessante

  by  e.fernandots@gmail.com, 6 months ago


RNGCryptoServiceProvider implements IDisposable and should, therefore, be wrapped in a using statement (don't know what the y variable is for, though):

    byte[] randomNumber;
    using (RNGCryptoServiceProvider rngCsp = new RNGCryptoServiceProvider())
    {
        int y = 10;
        randomNumber = new byte[25];
        rngCsp.GetBytes(randomNumber);
    }

    int x = 0;

    for(int i=0;i<randomNumber.Length;i++){
        Console.WriteLine("Posição: " + (i+1) + " Valor: " + randomNumber[i]);
        x += randomNumber[i];
    }
  by  Jesse C. Slicer, 1 days ago




Please log in to post a comment.
tst
726