I deduced this myself when I wrote an AI for Ludo, so that it chooses one of the possible moves - equally likely - as the moves are getting generated :)
Some other similar logic - Selecting n distinct items out of N, all C(N,n) selections being equally likely, passing through the data only once :)
And the next step - if the data can be accessed randomly, the above can be done in O(n) time instead of O(N) through a modification of the algo, still giving a statistically equivalent sampling scheme.
Some other similar logic - Selecting n distinct items out of N, all C(N,n) selections being equally likely, passing through the data only once :)
And the next step - if the data can be accessed randomly, the above can be done in O(n) time instead of O(N) through a modification of the algo, still giving a statistically equivalent sampling scheme.