oop - Efficiently: Random numbers in fixed range without repetitions -


O people, I know there are one million questions on random numbers, but in fact I searched a lot but due to this I could not find anything like mine - it does not mean that there is not in it in any case, please forgive me if I am repeating any question, then just tell me that this is the case.

So, I want to do something simple in the easiest way.

I randomly generate all the N integers in the range as [0, n] , one by one, such a repetition is not.

I know, I can do this by putting everything in the list , rotate it, get head, and then remove head from the list. But then I will change the length of my list to N , N-1 .

Any better / sharp thoughts?

You can only make one alteration, and then take action through the list.



Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -