title: Generate a random LocalDate with java.time
body: <p>I'm writing some code to populate a MySQL database with random data for testing purposes. I need to populate a <code>DATE</code> column with random dates from 1970-2015.</p>
  
  <p>Here's the relevant method:</p>
  
  <pre><code>public Date dateGenerator() throws Exception {
      Random ry = new Random();
      Random rm = new Random();
      Random rd = new Random();
      int year = 1969 + ry.nextInt(2015-1969+1);
      int month = 1 + rm.nextInt(12);
      int day = 1 + rm.nextInt(31);
  
      if (month==2 &amp;&amp; day&gt;28){
          day = day - 3;            
      } else {
          if((month%2==0 &amp;&amp; month != 8 ) &amp;&amp; day==31 ){
              day = day -1;
          }
      }
  }
  </code></pre>
  
  <p>My purpose is to create three random integers (for day, month, year) and somehow combine them into some Date object to pass to the database. But the database rejects everything I try to feed it.</p>
  
  <p>It would be very educational for me if you can supply me with a suggestion based in the newest <code>java.time</code> library if this is possible.</p>