running a random function

Neil Cerutti horpner at yahoo.com
Thu Jun 7 20:30:59 CEST 2007


On 2007-06-07, Stebanoid <Stebanoid at gmail.com> wrote:
> if you have a list of functions you can try this:
>
> import random
> import math
> m[int(math.floor(len(m)*random.random()))]()  # seems like Lisp

Or rather m[random.randint(0, len(m))]()

-- 
Neil Cerutti
Caution: Cape does not enable user to fly. --Kenner's Batman costume



More information about the Python-list mailing list