title: Random date and time C# from last week
body: <p>I am trying to generate a start and end date time from last week.</p>
  <p>so if today is 04/02/2022 then I need a random date and time from last week so it could be</p>
  <p>Start 02/02/2022 10:00</p>
  <p>End 02/02/2022 10:30</p>
  <p>notice that the end time is 30 mins always.</p>
  <p>I can get the date part working by using this</p>
  <pre><code>Random gen = new Random();
  var start = DateTime.Now.AddDays(-7);
  int range = (DateTime.Today - DateTime.Today.AddDays(-7)).Days;
  
  var result = start.AddDays(gen.Next(range));
  </code></pre>