[ python-Bugs-1590891 ] random.randrange don't return correct value for big number

SourceForge.net noreply at sourceforge.net
Sun Nov 5 17:54:06 CET 2006


Bugs item #1590891, was opened at 2006-11-06 01:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1590891&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: MATSUI Tetsushi (mft)
Assigned to: Nobody/Anonymous (nobody)
Summary: random.randrange don't return correct value for big number

Initial Comment:
Python 2.4.3 (#1, Oct  3 2006, 00:36:06)
[GCC 4.1.1 (Gentoo 4.1.1-r1)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import random
>>> random.randrange(1000000000000,
-100000000000000000000, -200)
267471051174796896L

Obviously, the result is not in the specified range;
1000000000000 < 267471051174796896,
-100000000000000000000 < 267471051174796896
and
(267471051174796896 - 1000000000000) % (-200) != 0.

I'm using 2.3.5 and 2.4.3, and their behaviors are
identical.
I haven't checked about 2.5.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1590891&group_id=5470


More information about the Python-bugs-list mailing list