On Aug 30, 3:55 pm, Ivan Voras <[EMAIL PROTECTED]> wrote:
> I've noticed something interesting in my test: the value 0 appears less
> often than other values (which behave as they should).

That's because the call to abs() usually collapses two values to one
(e.g. -2 and 2 both end up being 2),
but there's only one integer n for which abs(n) == 0.

One possible fix:  do

  x = randint(0, 10) - randint(0, 10)
  x = abs(x) - (x<0)

This collapses -1 and 0 to 0, -2 and 1 to 1, etc.

Mark

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to