pick randomly a certain fraction of numbers from a list

Richard Brodie R.Brodie at rl.ac.uk
Fri Feb 14 13:44:12 EST 2003


"Yuval" <yuvalfeld at hotmail.com> wrote in message
news:6ca96053.0302141032.524e1d8c at posting.google.com...

> Does anybody know a quick way of picking randomly x% of elements from a list.

Quick in what sense? Taking a slice from random.shuffle(list) would be a quick and
dirty way, if not the most elegant algorithm.








More information about the Python-list mailing list