Re: Test data generation using Perl Scripting.

2007-09-07 Thread John W. Krahn
Chas Owens wrote: On 9/7/07, Beginner <[EMAIL PROTECTED]> wrote: On 7 Sep 2007 at 9:47, Chas Owens wrote: On 9/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: snip #FIXME: this creates invalid dates like 2007-02-30 sub rand_date { sprintf "%04d-%02d-%02d", 2000 + int rand

Re: Test data generation using Perl Scripting.

2007-09-07 Thread Chas Owens
On 9/7/07, Bob McConnell <[EMAIL PROTECTED]> wrote: > How often will int rand 7 == 7? I think the max year will be 2006 in > this case. > > Bob McConnell snip They will be equal roughly zero percent of time (they might actually be equal if there is a bug in the implementation of int, rand, or ==).

RE: Test data generation using Perl Scripting.

2007-09-07 Thread Bob McConnell
How often will int rand 7 == 7? I think the max year will be 2006 in this case. Bob McConnell > -Original Message- > From: Chas Owens [mailto:[EMAIL PROTECTED] > Sent: Friday, September 07, 2007 9:57 AM > To: Beginner > Cc: beginners@perl.org > Subject: Re: Test dat

Re: Test data generation using Perl Scripting.

2007-09-07 Thread Chas Owens
On 9/7/07, Beginner <[EMAIL PROTECTED]> wrote: > On 7 Sep 2007 at 9:47, Chas Owens wrote: > > > On 9/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > snip > > > #FIXME: this creates invalid dates like 2007-02-30 > > > sub rand_date { > > > sprintf "%04d-%02d-%02d", > > > 2000

Re: Test data generation using Perl Scripting.

2007-09-07 Thread Beginner
On 7 Sep 2007 at 9:47, Chas Owens wrote: > On 9/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: > snip > > #FIXME: this creates invalid dates like 2007-02-30 > > sub rand_date { > > sprintf "%04d-%02d-%02d", > > 2000 + int rand 7, > > 1 + int rand 12, > >

Re: Test data generation using Perl Scripting.

2007-09-07 Thread Chas Owens
On 9/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: snip > #FIXME: this creates invalid dates like 2007-02-30 > sub rand_date { > sprintf "%04d-%02d-%02d", > 2000 + int rand 7, > 1 + int rand 12, > 1 + int rand 31; > } snip Actually that sub can

Re: Test data generation using Perl Scripting.

2007-09-07 Thread Chas Owens
On 9/7/07, Satya <[EMAIL PROTECTED]> wrote: snip > If it is possible to do it using the perl or any other scripting > language, what would be the approach. snip It is possible; the approach is the same as in all languages: use random numbers to select/build strings that match your needs. For inst