randrange loops
Terry Reedy
tjreedy at udel.edu
Sun Jun 15 16:05:02 EDT 2008
<luislupe at gmail.com> wrote in message
news:6e424f2a-872d-4dd1-b28d-cf2a985895c9 at j22g2000hsf.googlegroups.com...
| 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
Are we to presume that self.rr is rr?
| 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?
On what line does it 'loop forever'?
Are you saying that the same code with same input sometimes works and
sometimes does not? In any case, try to reduce it to the minumum that
either always or sometimes fails. And post that.
tjr
More information about the Python-list
mailing list