At [Fri, 17 Jan 1997 12:24:46 -0500 (EST)]
Sammy <Samedi@cris.com> wrote:
>
> On Fri, 17 Jan 1997 BuckFloyd@aol.com wrote:
>
> - > if (number(0,100) > number(0, 100))
> - > {
> - > if ((number(0, 100) < 50) && (number(0, 100) > 85))
> - > {
>
> Wow that really is odd. To each his or her own, I guess, but it's a
> little wasteful of processor time. I think somoene who's had a statistics
> class could break those 4 random numbers down and turn it into one.
>
> This is my take on it:
>
> - > if (number(0,100) > number(0, 100))
>
> This looks like a 50-50 chance to me, which could be changed to:
>
> if(number(0, 1))
>
> And add these in:
>
> - > if ((number(0, 100) < 50) && (number(0, 100) > 85))
>
> Hmm another 50-50, and a %15 chance. Since these are all and'ed together,
> if my wild guess at statistics is correct, you've got a 50/100 + 50/100 +
> 15/100 chance of getting through all the ifs, or 115/300, or a 38%. Am I
> close? If so, then you could consolidate all four random number
> generators into this one line:
>
> if(!number(0, 37))
>
> Sam
> p.s. Yeah I know my numbers aren't exact, it's the formula I'm wondering
> about :P
>
Hmm. I was going to post much the same thing, but I had figured it at
about 4%. 50% 50% 15% .. #1 falls through half the time.. #2 does the
same so that yields about 25% .. 15% of 25% would be about 4%. So:
if (number(1,100) =< 4 ) {
}
would seem to be equivalent, yet use around a third of the processor
time. Though, seeing as it's not a string operation, one wonders how
much of an impact it really has.
--Mallory
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST