title: How to create byte array and fill it with random data
body: <p>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:</p>
  
  <pre><code>private byte[]  GetByteArray(int sizeInKb)
      {
  
  
      }
  </code></pre>
  
  <p>This is what I have tried:</p>
  
  <pre><code>private  byte[]  GetByteArray(int sizeInKb)
      {
  
          var rnd = new Random();
          var bytes = new Byte[sizeInKb*1024];
          rnd.NextBytes(bytes);
          return bytes;
      }
  </code></pre>
  
  <p>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.</p>