Simple algorithm question - how to reorder a sequence economically

Peter Brooks peter.h.m.brooks at gmail.com
Fri May 24 04:14:45 EDT 2013


What is the easiest way to reorder a sequence pseudo-randomly?

That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg
2,1,4,3) that is different each time.

I'm writing a simulation and would like to visit all the nodes in a
different order at each iteration of the simulation to remove the risk
of a fixed order introducing spurious evidence of correlation.



More information about the Python-list mailing list