in reply to Who Needs to Find the Permutations of a List?

How about for generating quizzes, where you want to select M (<= N) distinct questions from a set of N questions, mixing the order to prevent 'cheating' or similar. Permutating the list beforehand simply allows one to pop or shift off new questions instead of continuing to do a loop on a random number until you reach one that hasn't been done.

Also, not just only for genetic simulations, but for other cases where order may or may not matter (say, travelling salesmen approach with genetic algorithsm), permutations are easier to start with then trying to build up a 'random' list .

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
It's not what you know, but knowing how to find it if you don't know that's important

  • Comment on Re: Who Needs to Find the Permutations of a List?