lundi 28 janvier 2019

Is it possible to generate different random numbers faster than O(n)?

I have a range of numbers from 1-10 and I want to pick out 3 randomly but never the same twice. In lua I used a Fisher-Yates shuffle which is O(n), I know python has a built-in random.sample() also O(n). Can it be done faster with an arbitrary range and number of picks?




Aucun commentaire:

Enregistrer un commentaire