Hi,
Does boost's date provide a random date generation?
Or somehow should I generate my own date and then pass as a parameter?


date GeneratorUtils::getRandomDate() {
    int year, month ,day;
    day = 1 + rand() % 29;
    month = 1 + rand() % 11;
    year = 1980 + rand() % 25;
    date d(year, month, day);

    return d;
}

currently this is my implementation, but sometimes it returns invalid month value.
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month> >'
  what():  Day of month is not valid for year

Probably because of something like 29th Feb or sth like that. I rarely saw that exception.

I could modify the code easiy but I just wanted to know that if such a functionality exists?
Thanks a lot, I've started to adore boost after uuid & date =)

--
Saygin