How to fill byte array with junk? C#

Posted by flyout on Stack Overflow See other posts from Stack Overflow or by flyout
Published on 2010-06-06T17:45:08Z Indexed on 2010/06/06 17:52 UTC
Read the original article Hit count: 219

Filed under:
|
|
|
|

I am using this:

byte[] buffer = new byte[10240];

As I understand this initialize the buffer array of 10kb filled with 0s.

Whats the fastest way to fill this array (or initialize it) with junk data everytime?

I need to use that array like >5000 times and fill it everytime with different junk data, thats why I am looking for a fast method to do it. The array size will also have to change everytime.

© Stack Overflow or respective owner

Related posts about c#

Related posts about arrays