I want to create a byte array against the given size filled with random data.How can I do that?Signature of my method would be like this:
private byte[] GetByteArray(int sizeInKb)
{
}
This is what I have tried:
private byte[] GetByteArray(int sizeInKb)
{
var rnd = new Random();
var bytes = new Byte[sizeInKb*1024];
rnd.NextBytes(bytes);
return bytes;
}
Here I want to return byte array conataining random data against value of sizeInKb. Is my array size correct , when user inputs value in kb e.g. 10 KB.