filtering random values (sieves?)
Emile van Sebille
emile at fenx.com
Wed Feb 13 11:48:45 EST 2002
From: "kevin parks"
> I am not sure I am even using the right terminology here, but I
> looking for a way to filter random values. Let's say that I am using
> random and randrange to generate values from 0-11, but i only want to
> accept values 1, 3, 5, 7, 11,
Does this help:
>>> import random
>>> random.choice([1,3,5,7,11])
7
Emile van Sebille
emile at fenx.com
---------
More information about the Python-list
mailing list