Joel:
Most random number generators, including VFP's rand(), generate a real
number between 0 and 1. Standard practice is to draw the number, then
multiply by your range, then add the minimum allowable value.
I.e., MyValue = MyRange * rand() + MyMinimum
If you need to force the results into integers, then bear in mind that
the int() function truncates rather than rounding. Simplest cure for
this is to add 1.
i.e., MyValue = int(8 * rand() + 3)
As Ed said, throwing out 1's and 2's is just wasting time.
Dan Covill
On 09/30/2010 4:56 PM, Joel N. Fischoff wrote:
> Heya,
>
> I have an odd question (hence the 'OT') on the statistics of random number
> generation. I figure there's a good chance that there are people who have
> strong knowledge of/a degree in statistics here, which is why I'm asking.
>
> Here's the deal: I want to randomly generate a number between 3 and 10. Is
> it more probable that I will get a higher number if I generate the number
> directly (i.e. between one and ten, and ignoring if I get one or two), or
> if I generate it indirectly (by generating a number between one and eight
> and adding two). It seems more likely that the latter would generate
> higher numbers more probably, because the chance of generating any given
> number (between one and eight) is 12.5%, while the former is 10% even. Am
> I right, wrong, or it just doesn't make one bit of difference?
>
>
> Joel
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.