Re: Dice
Re: Dice
- Subject: Re: Dice
- From: "Adam K. Wuellner" <email@hidden>
- Date: Tue, 26 Oct 2004 14:00:30 -0500
Redirecting to the list, on behalf of Tom.
Begin forwarded message:
From: Tom Humiston <...>
Date: October 26, 2004 1:02:58 PM CDT
Subject: Re: Dice
set freq to {0, 0, 0, 0, 0, 0}
repeat 10000 times
set roll to random number from 1 to 6
set item roll of freq to (contents of item roll of freq) + 1
end repeat
freq
-- three sequential runs produced:
-- {1663, 1610, 1682, 1633, 1785, 1627}
-- {1669, 1698, 1646, 1644, 1676, 1667}
-- {1664, 1662, 1676, 1722, 1607, 1669}
I used "some item" instead of "random number" and the script runs much
faster -- about 1 sec. vs. about 1.5 min.
set freq to {0, 0, 0, 0, 0, 0}
set nums to {1, 2, 3, 4, 5, 6}
repeat 10000 times
set roll to some item of nums
set item roll of freq to (contents of item roll of freq) + 1
end repeat
freq
set names to {"one", "two", "three", "four", "five", "six"}
set roll to random number from 1 to 6
item roll in names
I tried this and got; -- by running over and over.
"four"
"two"
"two"
"six"
"four"
"two"
"two"
"two"
"four"
Doesn't seem very random at first glance.
Well, yes, because your sample size is so small. That's why the above
script runs 10,000 times, not 9.
- Tom
_______________________________________________
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