davitv / chance

Minimalist generator of random strings, numbers, etc.
MIT License
29 stars 6 forks source link

Add pickone method #2

Closed rzschech closed 6 years ago

rzschech commented 6 years ago

I often want to pick one from a collection of values. Can we have a method similar to http://chancejs.com/#pickone

For example:

def pickone(list):
  return list[random.randint(1, len(list) - 1)]

Thanks

davitv commented 6 years ago

Thanks for suggestion! Added pickone method and uploaded new release to PyPi.

rzschech commented 6 years ago

Nice one, thanks :-)