title: Generate random list of timestamps in python
body: <p>I'm trying to generate random list of 24hr timestamps. I can generate one sample of date and time between the set range using the code below. I'm hoping to generate multiple samples (e.g. 10 samples)</p>
  
  <p>Also, the date component isn't a priority for me. If i could drop that and just generate random 24hr timestamps that would be good.</p>
  
  <p>Most threads I've found only consider generate random dates. I can find anything that concerns time.</p>
  
  <pre><code>import random
  import time
  from datetime import datetime
  
  def randomDate(start, end):
      frmt = '%d-%m-%Y %H:%M:%S'
  
      stime = time.mktime(time.strptime(start, frmt))
      etime = time.mktime(time.strptime(end, frmt))
  
      ptime = stime + random.random() * (etime - stime)
      dt = datetime.fromtimestamp(time.mktime(time.localtime(ptime)))
      return dt
  
  random_datetime = randomDate("20-01-2018 13:30:00", "23-01-2018 04:50:34")
  
  print(random_datetime)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>2018-01-21 03:33:55
  </code></pre>