Comment Comment by jdfr Vitter's algorithm is for when you need to generate a random list of unique items with sequential reads. If you drop that requirement, you can just use a substitution-permutation network: https://en.wikipedia.org/wiki/Substitution-permutation_netwo...A SPN will generate a unique random permutation, from which you can draw your random list of unique items. With a little of post-ptocessing, you can generate random permutations of arbitrary size.I have implemented it in matlab and python:http://nl.mathworks.com/matlabcentral/fileexchange/36626-alg...https://gist.github.com/jdfr/46633c630471494d67ae parent jdfr 10 years ago
A SPN will generate a unique random permutation, from which you can draw your random list of unique items. With a little of post-ptocessing, you can generate random permutations of arbitrary size.
I have implemented it in matlab and python:
http://nl.mathworks.com/matlabcentral/fileexchange/36626-alg...
https://gist.github.com/jdfr/46633c630471494d67ae