Generating a random binary file

Viewed 28532

Why did it take 5 minutes to generate a 1 KiB file on my (low-end laptop) system with little load? And how could I generate a random binary file faster?

$ time dd if=/dev/random of=random-file bs=1 count=1024
1024+0 records in
1024+0 records out
1024 bytes (1.0 kB) copied, 303.266 s, 0.0 kB/s

real    5m3.282s
user    0m0.000s
sys 0m0.004s
$ 

Notice that dd if=/dev/random of=random-file bs=1024 count=1 doesn't work. It generates a random binary file of random length, on most runs under 50 B. Has anyone an explanation for this too?

5 Answers
Related