title: Generate random date in a particular month and year
body: <p>I have a list of dates. For each of these dates, keeping the month and year same, I need to generate a random date. I tried using this code:</p>
  
  <pre><code>def get_random_date(date):
      r_int = random.randint(1, 28)  #line 2
      rand_date = date[0:4] + date[5:7] + str(r_int)
      randm_date = datetime.datetime.strptime(rand_date, '%Y%m%d').date()
      return randm_date
  </code></pre>
  
  <p>But in this code I would never be getting 29, 30 or 31. If I remove the 28 in line 2 I might get 30 Feb or something like that. How to avoid this?</p>
  
  <p>Edit: I do not need to get a random date b/w 2 dates. This is a different question. Plz let me know what other details I can provide to not get this marked duplicate.</p>