title: Generating a random binary file
body: <p>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? </p>
  
  <pre><code>$ 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
  $ 
  </code></pre>
  
  <p>Notice that <code>dd if=/dev/random of=random-file bs=1024 count=1</code> 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?</p>