Re: Dice
Re: Dice
- Subject: Re: Dice
- From: Joseph Weaks <email@hidden>
- Date: Wed, 27 Oct 2004 02:10:32 -0500
On Oct 27, 2004, at 1:55 AM, Malcolm Fitzgerald wrote:
Not bad, if there were not some item! :)
kai wrote:
Hm... 'some paragraph' has the edge OMM - although my test differs
from yours somewhat.
I used 1000 items, characters, words, paragraphs, etc and repeated
1000 times to get these two sets of results from Smile's chrono on a
G4 400.
....Paragraph is a strong performer but it is slower than random
number here and they are both left in the dust by character.
And I am getting even differenter results picking randomly from a set
of ten repeating a million times as per this handler:
on doIt(theSet)
set t1 to current date
if theSet = "" then
repeat 1000000 times
set x to random number from 1 to 10
end repeat
else if class of theSet is string then
repeat 1000000 times
set x to some paragraph of theSet
end repeat
else if class of theSet is list then
repeat 1000000 times
set x to some item of theSet
end repeat
else
return "huh?"
end if
set t2 to current date
return (t2 - t1)
end doIt
set theSet to {"one", "two", "three", "four", "five", "six", "seven",
"eight", "nine", "ten"}
doIt(theSet)
--26
set theSet to {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
doIt(theSet)
--26
set theSet to "one
two
three
four
five
six
seven
eight
nine
ten"
doIt(theSet)
--23
doIt("")
--238
How such a huge difference for the "random number" method?
Cheers,
Joe Weaks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
- Follow-Ups:
- Re: Dice
- From: Jon Pugh <email@hidden>
- Re: Dice
- From: Malcolm Fitzgerald <email@hidden>
References: | |
| >Re: Dice (From: kai <email@hidden>) |
| >Re: Dice (From: Malcolm Fitzgerald <email@hidden>) |