|
|
|
|
|
by amcsi
2469 days ago
|
|
So let me get this straight... This algorithm creates an initially empty array of size K with the DB internal ids of what would randomly be selected.
Then it goes in order from 0 to the number of rows - 1, and for each one it goes e.g.
"What are the chances that number 0 would get randomly picked out of N items if K items need to be picked?"
Then, if the #0 passes the "random check", it gets added. Then it would go to 1 and go
"What are the chances #1 would be picked out of N-1 items if K-1 items need to be picked?"
...and repeated so on until all K random items have been picked? |
|