randomly generate n of each of two types

Alan Isaac aisaac at american.edu
Sun Feb 11 19:57:35 EST 2007


"Stargaming" <stargaming at gmail.com> wrote in message
news:eqo184$2u7e$1 at ulysses.news.tiscali.de...
> ...   types *= n
> ...   shuffle(types)

This again has the "costs" I referred to:
creating a potentially large sequence,
and shuffling it.  (Additionally, shuffle
cannot achieve many of the possible
shuffles of a large list, but I doubt this
is easily evaded.)

So as far as I can tell, this is the same
approach as the original (first) solution.

Cheers,
Alan Isaac





More information about the Python-list mailing list