|
Boost Users : |
Subject: Re: [Boost-users] [date_time] how to generate a random date?
From: Saygin Arkan (saygenius_at_[hidden])
Date: 2010-05-14 04:26:13
Thanks a lot, much more efficient...
SA
On Thu, May 13, 2010 at 3:53 PM, Joost Kraaijeveld <J.Kraaijeveld_at_[hidden]
> wrote:
> On Thu, 2010-05-13 at 15:21 +0300, Saygin Arkan wrote:
> > 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;
> > }
>
>
> date GeneratorUtils::getRandomDate() {
>
> return (date d(1980, 1, 1) + date_duration(rand());
> }
>
> --
> Groeten,
>
> Joost Kraaijeveld
> Askesis B.V.
> Molukkenstraat 14
> 6524NB Nijmegen
> tel: 024-3888063 / 06-51855277
> fax: 024-3608416
> web: www.askesis.nl
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
-- H. Saygin Arkan Tampere University of Tech. CS / III - +358466646156
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net