April 13, 2012

Create a file with random bytes

I periodically need to create a file with random content. I use the following code.
dd if=/dev/urandom of=file.data count=102400 bs=1024 iflag=fullblock
Here the final file size is bs*count bytes. Note that I am using urandom instead of random as I am not using the random numbers for some security operation and I am not bothered about the entropy.

No comments: