EN
C#/.NET - generate random bytes
2
points
Random
bytes example
public static class RandomUtils
{
public static string generateBytes(int count)
{
Random random = new Random();
byte[] result = new byte[count];
random.NextBytes(result);
return result;
}
}
Example:
string bytes = RandomUtils.generateBytes(6);
foreach(byte entry in bytes)
Console.Write(entry + " ");
Console.WriteLine();
Output:
34 4 1 197 85 145