No it is 3 factorial. Jacques and Craig and I are right. This is picking without replacement, not picking with replacement. The first answer position has three choices. Once you pick it the second answer position has 2 and the final position 1 option left. To get 27 options means you have answer sheets where the first answer is option 3, you return option 3 to the list and the second answer is option 3 and you return option 3 to the list and the third question is option three and other such. Sort by defaults to an ordering which makes sense in these cases making it look like you have a right answer ordering.
Michael On May 23, 2013, at 12:20 PM, Dar Scott <[email protected]> wrote: > Easy mistake to make, Jacques, but it is not 3!. > > Random() emulates independent random numbers. It cannot avoid numbers > returned before in the sort. Each line will get a randomly assigned number > independent of the other lines. > > The number of ways 3 lines can be ordered does not apply. > > Each line will be assigned a number by random(). So it is possible that the > first line will be assigned a 2 and the other lines assigned 2, also. The > probability of that is one out of 3^3. (Not three factorial) > > You can create a function to log the assignments and use that as the > comparison metric function. You can see the assignments, and different lines > can have the same value. > > Each sort will get a random pattern of 1, 2 and 3. There are 27 of them. > > Fourteen of them will cause a sort with the first line coming first again. > That is 52%, not 33%. > > You can write code to sort the same starting string a thousand times and the > same first line will show up 52% of the time, not 33%. > > Dar > > On May 22, 2013, at 6:16 PM, Jacques Hausser wrote: > _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
