title: generate large csv with random content in bash
body: <p>I am trying to generate a large csv with random content in bash. My machine has 6 cores and 12G ram but my script (see below) takes 140 seconds for only 10k lines with 3 columns.  Is there any way to optimize this script?</p>
  
  <p>Are there considerably faster ways of generating random csv files in other languages?</p>
  
  <pre><code>#!/bin/bash
  
  csv="foo\tbar\tbaz"
  start=$(date)
  for i in `seq 1 $1`
    do rand=$(($i * $RANDOM))
    str0="$$"$i
    str1=$( echo "$str0" | md5sum )
    randstring1="${str1:2:8}"
    randstring2="${str1:0:2}"
    csv="$csv\n$randstring1\t$randstring2\t$rand"
  done
  end=$(date)
  datediff=$(( $(date -d "$end" +%s) - $(date -d "$start" +%s)))
  echo -e $csv &gt; my_csv.csv
  echo "script took $datediff seconds for $(wc -l my_csv.csv) lines"
  </code></pre>