Re: [Tutor] generating independent random numbers

2010-09-30 Thread Steven D'Aprano
On Thu, 30 Sep 2010 02:38:31 pm Dave Angel wrote: [snip nearly 300 lines of quoted text and 7 lines of new content] Dave, and Carter, are the delete and backspace keys on your keyboards broken? There's no need to quote the ENTIRE thread every time you reply, and then quote it in full AGAIN a

Re: [Tutor] generating independent random numbers

2010-09-29 Thread Peter Otten
Carter Danforth wrote: Thanks for the replies, Dave and Joel. The reason I'm not just using the time or datetime modules for a random date is because it's restricted to 1970-2038; I'm pulling dates from 1600-3099. Thanks a lot for the pointer The datetime module is not restricted to

Re: [Tutor] generating independent random numbers

2010-09-29 Thread Ewald Ertl
Hi, On Wed, Sep 29, 2010 at 11:42 AM, Peter Otten __pete...@web.de wrote: Carter Danforth wrote: Thanks for the replies, Dave and Joel. The reason I'm not just using the time or datetime modules for a random date is because it's restricted to 1970-2038; I'm pulling dates from 1600-3099.

Re: [Tutor] generating independent random numbers

2010-09-29 Thread Peter Otten
Ewald Ertl wrote: Just an attempt from my side: The year 1500 didn't have a 29th of February, the 28th work for me but 29th also fails here. datetime.date( 1500, 2, 28 ) datetime.date(1500, 2, 28) datetime.date( 1500, 2, 29 ) Traceback (most recent call last): File stdin, line 1, in

Re: [Tutor] generating independent random numbers

2010-09-29 Thread Carter Danforth
Wow... I'm really slipping here with the leaps years, good catch on the 2000s. And yeah, a list does make a whole lot more sense. Thanks Dave. I've checked multiple sources on Zeller's formula, initially came across it on this book on vedic math (highly recommend it): http://amzn.to/bNXBM6. But

Re: [Tutor] generating independent random numbers

2010-09-29 Thread Dave Angel
On 9/28/2010 5:11 PM, Carter Danforth wrote: Thanks for the replies, Dave and Joel. The reason I'm not just using the time or datetime modules for a random date is because it's restricted to 1970-2038; I'm pulling dates from 1600-3099. Thanks a lot for the pointer about the leap years, Dave, as

Re: [Tutor] generating independent random numbers

2010-09-29 Thread Carter Danforth
On Wed, Sep 29, 2010 at 1:53 PM, Dave Angel da...@ieee.org wrote: On 9/28/2010 5:11 PM, Carter Danforth wrote: Thanks for the replies, Dave and Joel. The reason I'm not just using the time or datetime modules for a random date is because it's restricted to 1970-2038; I'm pulling dates from

Re: [Tutor] generating independent random numbers

2010-09-29 Thread Dave Angel
On 9/29/2010 9:17 PM, Carter Danforth wrote: On Wed, Sep 29, 2010 at 1:53 PM, Dave Angelda...@ieee.org wrote: On 9/28/2010 5:11 PM, Carter Danforth wrote: Thanks for the replies, Dave and Joel. The reason I'm not just using the time or datetime modules for a random date is because it's

Re: [Tutor] generating independent random numbers

2010-09-29 Thread Dave Angel
On 2:59 PM, Dave Angel wrote: On 9/29/2010 9:17 PM, Carter Danforth wrote: On Wed, Sep 29, 2010 at 1:53 PM, Dave Angelda...@ieee.org wrote: On 9/28/2010 5:11 PM, Carter Danforth wrote: Thanks for the replies, Dave and Joel. The reason I'm not just using the time or datetime modules

Re: [Tutor] generating independent random numbers

2010-09-28 Thread Carter Danforth
Thanks for the replies, Dave and Joel. The reason I'm not just using the time or datetime modules for a random date is because it's restricted to 1970-2038; I'm pulling dates from 1600-3099. Thanks a lot for the pointer about the leap years, Dave, as well the class instances; just updated it and

Re: [Tutor] generating independent random numbers

2010-09-28 Thread Dave Angel
On 9/28/2010 5:11 PM, Carter Danforth wrote: Thanks for the replies, Dave and Joel. The reason I'm not just using the time or datetime modules for a random date is because it's restricted to 1970-2038; I'm pulling dates from 1600-3099. Thanks a lot for the pointer about the leap years, Dave, as

[Tutor] generating independent random numbers

2010-09-27 Thread Carter Danforth
Hi, I'm writing a program that's testing speed calculation of calendar dates from any date spanning 1600-3000. I want it to generate a random date and then prompt the user to indicate the correct day of the week using Zeller's formula. Included below is just some of the code to show what I'm

Re: [Tutor] generating independent random numbers

2010-09-27 Thread Steven D'Aprano
On Tue, 28 Sep 2010 08:55:36 am Carter Danforth wrote: class Date: c = random.randint(16,30) y = random.randint(0,99) month = random.randint(1,12) Here's your problem: you are creating a class where all the attributes (called members in some other languages) belong to the class

Re: [Tutor] generating independent random numbers

2010-09-27 Thread Joel Levine
You might try fixing up the following. I did not match the scale to what you are looking for. But the trick is to take advantage of the time module's association of numbers with dates: import time import random Sample output Wed Apr 29 14:35:58 1992 Thu Jun 24 12:04:15 1971 Fri Oct 7

Re: [Tutor] generating independent random numbers

2010-09-27 Thread Dave Angel
On 2:59 PM, Steven D'Aprano wrote: On Tue, 28 Sep 2010 08:55:36 am Carter Danforth wrote: class Date: c = random.randint(16,30) y = random.randint(0,99) month = random.randint(1,12) Here's your problem: you are creating a class where all the attributes (called members in some