[Tutor] Sum of Scores

Luke Paireepinart rabidpoobear at gmail.com
Sat Jul 28 11:38:17 CEST 2007

On 7/27/07, Tiger12506 <keridee at jayco.net> wrote:
> Hmmm... interesting tie to another post...
> >>> x = timeit.Timer('random.random()','import random')
> >>> x.timeit(3000000)
> 1.0161026052194018
> >>> y = timeit.Timer('random()','from random import random')
> >>> y.timeit(4600000)
> 1.0004307810070827
> Dictionary lookups do take HUGE amounts of time. Interesting.
> Anyway... I've got it down to
> Your numbers with a little more precision gave me
> 3.4e5987 yrs.
> and mine
> 3.0e5987 yrs.
> That's a hell of a lot of years! Remember that everyone! If you want your
> code to run forever and to eternity, copy variables to the local namespace
> first; you get a lot more accomplished (well... whatever)    ;-)
> Anyway, the frivolity aside, I can get it to repeat every ten seconds. ;-)
> Set the computer clock. (okay, maybe i'm just in a silly mood. But
> seriously,
> that's why the docs say that it is NOT meant for cryptography - not that
> that matters
> to the OP, snicker; What have I been drinking????)
> > Well, I was trying to emphasize that it was, for pretty much all intents
> > and purposes, infinite.
> Nope-nope-nope you're wrong :-)~

The way I understood the 'period' of the  random function was that after x
calls to the function, you would start getting the same pattern of results
as you did to begin with, in _the same running process_ of a program.
This is a separate situation from having the clock be exactly the same and
getting the same random values on program start - we already knew that would
happen, because the seed hadn't changed.
Unless I understand the period wrong, but I don't think so.

The daring cracker enters the room, his heart quickening as the door hinge
> creaks with the sound of the smallest ever mouse. His dark clothing masks
> him from the lit room visible through the window on the adjacent wall. A
> woman, working late, sits in a comfortable office chair, her face glowing
> from the reflection of her computer screen. A cup of Java (pun intended)
> indicates to anyone watching that she is overworked, and under-paid.
> Each step he takes brings him closer to his target. The big boss gave him
> a
> pay cut so that this new PC could sit on his boss's desk. The cracker's
> jealously seems to almost permeate the room. Vengeance shouts out louder
> than the compressor of the air conditioner in the north window. The
> cracker
> intinctively looks up to see if his emotions betrayed his presence. But
> the
> woman in the other room continues her scrolling through endless lines of
> buggy, hard to read, unmaintainable, bloated, and otherwise ridiculously
> foolish code that could have been so easily fixed if the same 'big boss'
> had
> ordered the project in Python.
> Soon, a floppy disk is pulled out of a black jacket pocket. No one has
> ever
> run the program on the floppy before. Taking the disk, the cracker inserts
> it into the drive, starts the machine, swears under his breath when he
> reads
> "Non-System disk or disk error. Replace and strike any."
> Striking the 'any' key, he quickly shoves the floppy disk back in. He
> wants
> this over with. Again, he looks to see if he has been detected; still he
> is
> safe. Opening the folder containing the floppy drive, he groans silently
> as
> the annoying Windows Firewall flashes an update notice. "See..." he thinks
> to himself, "Micro$oft *can* actually restrict viruses from entering their
> OS." He fights with the window, impatiently waiting for countless
> libraries
> to load and free, until the UI responds and he can send it a WM_CLOSE
> message.
> Smirking evily, the cracker double-clicks the executable
> 'pink_fuzzy_bunny.exe' and resists the urge to laugh maniacally as he
> watches the computer clock freeze and not move. Ingenious--his plan--All
> it
> takes to freeze time is to contantly set it to the same second in history.
> Time. Forever frozen. He frowns as he realizes that in so doing, he
> provides
> the only effective means for keeping those pesky Windows notices out of
> his
> boss's hair. "No matter" --he thinks, "He will have worse troubles in due
> time." Again he suppresses a maniacal laugh.
> . . .
> Monday morning brings a bright and cheerful man into an office, his
> office.
> The door creaks a little as he opens it, and the air conditioner buzzing
> in
> the north wall window is refreshing to him after the heat from outside.
> The
> man waves cheerfully at a woman through the glass in the adjacent wall,
> whom
> looks up only for an instant to scowl. The man, who recently bought his
> new
> PC, smiles proudly as he turns it on. His new python program which he
> keeps
> on the desktop is his early attempt at a cricket game simulation. He
> lovingly double-clicks the icon, and runs the program several times. Each
> successive time his grin grows smaller and smaller until his face is more
> than troubled. Why is his program producing the same output every time? A
> scream is heard in the office "NOOOOOOO!!!!!!!!"
> The boss runs from the building, never to notice the clock in the
> bottom-right hand corner which still shows the caption '10:33 PM'.
> Somewhere, someplace a cracker lies in bed, a silly grin on his face. His
> objective, he knows, has been accomplished.

nice story.

> Because the possibility of my computer even existing after that long is
> > effectively zero, I consider the pattern to never repeat :)
> Ahhh...
> Your computer ~ sitting on a pedestal in the middle of nowhere in AD
> 3.0e5988, the last shrine to the ancient past-- A technological marvel to
> the ape like creatures whom are all that remain of the once all powerful
> race of human beings.
> Our ape, named Jogg, looks at the bright computer screen, jumps back in
> fear
> as the ancient Windows Beep function is called and the foreign noise hits
> him. What is this? There is a message there.
> ...
> ...
>   File "<stdin>", line 2, in find
>   File "<stdin>", line 2, in find
>   File "<stdin>", line 2, in find
> RuntimeError: maximum recursion depth exceeded
> >>>
> Damn. I guess we will never know.
> (okay... maybe nobody spiked my Mt. Dew, but maybe because it's after 3:00
> am)

as a side note - are you going to enter the September Pyweek?  You should!
It's a lot of fun.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070728/e7872428/attachment.htm 

More information about the Tutor mailing list