def date(dayrange=10)
      if dayrange.is_a?(Range)
        offset = rand(dayrange.max-dayrange.min) + dayrange.min
      else
        offset = rand(dayrange*2) - dayrange
      end
      Date.today + offset
    end
def date(dayrange=10)
      if dayrange.is_a?(Range)
        offset = rand(dayrange.max-dayrange.min) + dayrange.min
      else
        offset = rand(dayrange*2) - dayrange
      end
      Date.today + offset
    end
Returns a date within a specified range of days.  If dayrange is an Integer, then the date
 returned will be plus or minus half what you specify.  The default is ten days, so by default
 you will get a date within plus or minus five days of today.

 If dayrange is a Range, then you will get a date the falls between that range

 Example:

 Random.date # => a Date +/- 5 days of today
 Random.date(20) # => a Date +/- 10 days of today
 Random.date(-60..-30) # => a Date between 60 days ago and 30 days ago