This content has been marked as final. Show 4 replies
I'm not sure what exactly you are trying to do, but you can use random
to figure out which list to use.
case random(10) of
--do something 70% of the time
--do something 20% of the time
--do something 10% of the time
YEah I sortta looked a that but random is totally random.
--Cancel, that your genius is in the simplicity.
Just did a rough test and it produces results within a reasonable tolerance. ( 65-80 out of 100, 25-35 out of 100, 5-12 out of 100)
FYI: I have 3 sections (Top 10, Coming Soon & Specials) I want the user to set the importance of the 3 sections and the larger the importance the more regulary it's displayed !!
> Just did a rough test and it produces results within a reasonable
> tolerance. (
> 65-80 out of 100, 25-35 out of 100, 5-12 out of 100)
Try something like this:
repeat with i = 1 to m
case random(10) of
-- "70.0128%, 19.9946%, 9.9925%"
Hey, I just throwing this out there for fun, but one of the few things I remember from grad school is that the probability of a particular set of multiple events is the product of the probability of each event separately. So for example, if you have 3 groups 1, 2, 3, and the items in each group are as follows:
1 = A, B, C, D, E, F, G, H, I, J
2 = A, B, C, D, E, F, G, H, I, J
3 = A, B, C, D, E
You’ve told us that the probability for group selection is 1=0.7, 2=0.2, and 3=0.1, the probability for item selection in each group is 1/(number of items in group) or 0.1 for groups 1 and 2, 0.2 for group 3. So…
the probability of getting a particular item in group 1 is 0.7 * 0.1 = 0.07 or 7% (for each of 10 items)
the probability of getting a particular item in group 2 is 0.2 *0.1 = 0.02 or 2% (for each of 10 items)
the probability of getting a particular item in group 3 is 0.1*0.2=0.02 or 2% (for each of 5 items)
So, given your numbers, you’ve got the unintuitive situation of a specific item in group 3 appearing with the same frequency as a specific item in group 2, although group 2 items will appear twice as frequently as a whole than group 3 items.