How to fill byte array with junk?

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 19:12 UTC
Read the original article Hit count: 432

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 every time?

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

© Stack Overflow or respective owner

Related posts about c#

Related posts about arrays