SPUG: Stick Riddle

On Thursday 02 January 2003 03:50 pm, Adrian Hands wrote:
>m3047 at inwa.net (Fred Morris) writes:
> > my gut tells me Michael has found it.
>> You realize it was
> the modification (norm_rand) to make the first break occur close to the
> middle that increased the probability to nearly 100%.
> Then, the modification to make it blindly choose the "left" piece,
> instead of the "longer" piece,
> for the second break, resulted in it picking the "longer" piece 1/2 the
> time...
> 1/2 of ~100% -> ~50%.
>> It seems unlikely to me that the "friend" based his answer on the idea
> that it's easier to break the stick in the middle.
>>That brings up a really good point! Instead of using rand(8), the rand()
should be done three times, using rand(99) each. Thus the randomized cuts
would truly reflect the percentage of each slice of the original stick.
jay
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org