title: Generate random date in specific range in spark scala
body: <p>For testing one of my application I need some huge data in parquet format. which I don't have.I have written a shell script which is performing slow.I wanted go with spark.How can I generate random data using spark scala.
  Each filed has to be in specific range.Id should be in between (1-10),date(any date from 2010-2018),start and end time should be any.
  My shell scipt.</p>
  <h1>!/bin/bash</h1>
  <pre><code>if [ $# -eq 2 ]; then
      LIMIT=40  # to generate 40KB file
      for((i=0;i&lt;$2;i++))
      {
          FILE_NAME=&quot;$1$i.csv&quot;
          echo &quot;id,date,start_time,end_time,distance,amount,persons,longitude,latitude&quot; &gt;&gt; &quot;$FILE_NAME&quot;
          while [ $(du -k $FILE_NAME | cut -f 1) -le $LIMIT ]
          do
              start_time=`date -d &quot;$(date +%H:%M:%S) + $(shuf -i 0-24 -n 1) hours $(shuf -i 0-60 -n 1) minutes $(shuf -i 0-60 -n 1) seconds&quot; +'%H:%M:%S'`
              echo &quot;`shuf -i 1-10 -n 1`,`date -d &quot;2011-01-01 + $(shuf -i 1-2557 -n 1) days&quot; +'%m-%d-%Y'`,$start_time,`date -d &quot;$start_time + $(shuf -i 1-6 -n 1) hours $(shuf -i 0-60 -n 1) minutes $(shuf -i 0-60 -n 1) seconds&quot; +'%H:%M:%S'`,`shuf -i 1-60 -n 1`,`shuf -i 100-1500 -n 1`,`shuf -i 1-6 -n 1`,`shuf -i 10-99 -n 1`.`shuf -i 100000-999999 -n 1`,`shuf -i 10-99 -n 1`.`shuf -i 100000-999999 -n 1`&quot; &gt;&gt; &quot;$FILE_NAME&quot;
          done
      }
  else
      printf &quot;Usage: sh GenerateCSV.sh &lt;filename without extension&gt; &lt;No of files to generate&gt; \nThe files will be generated with .csv extension\n&quot; 
  fi
  </code></pre>
  <p>I want data to be like this,which should be parquet format.</p>
  <pre><code>2,20-10-2010,23:18:10,23:40:40
  </code></pre>
  <p>How can I do it in spark.</p>