The following code contains extension methods for the random class.

One method will create random dates between a given minimum and maximum.

The second method creates boolean random values.

public static class RandomNumbers
  public static DateTime NextDate(this Random r, DateTime minDate, DateTime maxDate) {
    var ticks = maxDate.Ticks - minDate.Ticks;
    if (ticks > Int32.MaxValue)
      return maxDate;
    if (ticks <= 0)
      ticks = 1;
    int t = Convert.ToInt32(ticks);
    var delta = r.Next(t);
    return new DateTime(minDate.Ticks + delta);

  public static bool NextBoolean(this Random r)
    var result = r.Next(2);
    if (result == 0)
      return false;
      return true;