I need a way to generate a precise amount of psuedo-random (string) data. For example, I would like to code a method that takes an argument for the number of bytes to generate and returns a string of that precise size.
I originally intended to simply generate 1 character per byte needed, but apparently characters aren’t all a byte anymore.
Any help is appreciated!
I recommend using RNGCryptoServiceProvider it may generate as many random bytes as you want. You can then convert it to string (e.g. using byte64 encoding or other method).
Remember to add
using System.Security.Cryptography;to the file.