randrange loops

Cédric Lucantis omer at no-log.org
Sun Jun 15 20:48:12 CEST 2008


Le Sunday 15 June 2008 20:23:56 luislupe at gmail.com, vous avez écrit :
> Hi,
>
>
> I've created a method where the script defines twenty variables and
> several of them should be random having a maximum and a minimum value.
>
> What I did was this:
>
> from random import randrange as rr, random
>
> self.tr2_vezes = self.rr(self.d_tr2_vezes[0],self.d_tr2_vezes[-1],
> 1)     # just an example, others are similar

self.rr ? is it a typo or some method you defined yourself ?

>
> The minimum and maximum limits are never lower than -50 and higher
> than 250 and are integer.
>
> Many times, not always, the problem is that the script just loops
> forever and no value is chosen for the variable.
>
> What's happening here?  What am I doing wrong?
>

as it's very unlikely to be a bug in the randrange function I'd say something 
is wrong with your script but we'll need more infos to help. Can you post the 
whole function ?

-- 
Cédric Lucantis



More information about the Python-list mailing list