I implemented the below RandomDate, but I always keep getting values closed to "From" date, i probably miss something here....
public static DateTime GetRandomDate(DateTime from, DateTime to)
{
var range = new TimeSpan(to.Ticks - from.Ticks);
var rnd = new Random();
var randTimeSpan = new TimeSpan((long)(range.TotalSeconds - rnd.Next(0, (int)range.TotalSeconds)));
return from + randTimeSpan;
}
var rnd = new Random()
line will cause headaches if you intend to call this method frequently. – Tucson