static DateTime GetRandomDate(Random rand,
DateTime minDate, DateTime maxDate)
{
TimeSpan ts = maxDate - minDate;
int totalDays = (int)ts.TotalDays;
int randomDays = rand.Next(0, totalDays);
return minDate.AddDays(randomDays);
}
Showing posts with label Random Date. Show all posts
Showing posts with label Random Date. Show all posts
Wednesday, February 18, 2009
Get a Random Date
Subscribe to:
Posts (Atom)