This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xuinkrbin
Recipients xuinkrbin
Date 2008-09-21.03:36:53
SpamBayes Score 4.7328996e-07
Marked as misclassified No
Message-id <1221968215.79.0.562348738395.issue3918@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for random.uniform states:
    uniform(a, b)
        Return a random real number N such that a <= N < b.
However when I test it out, We see:
    >>> import random as r
    >>> r.uniform(0,-1)
    -0.9815056608839331
    >>> r.uniform(0,-1)
    -0.37308132546878092
    >>> r.uniform(0,-1)
    -0.57090673820243609
    >>> r.uniform(-1,0)
    -0.80471374256455697
    >>> r.uniform(3,2)
    2.9202748927236488
Now, while /I/ actually find this behavior *extremely* useful (I don't 
need to verify I call with the arguments in the `correct' order.), I 
think either the behavior needs to change to match the documentation or 
(preferably), the documentation needs alteration to read, for example, 
additionally:
    If a > b, this function behaves as if it were called as uniform(b,a).
Again, for clarity, I vote for the documentation change.
History
Date User Action Args
2008-09-21 03:36:55xuinkrbinsetrecipients: + xuinkrbin
2008-09-21 03:36:55xuinkrbinsetmessageid: <1221968215.79.0.562348738395.issue3918@psf.upfronthosting.co.za>
2008-09-21 03:36:54xuinkrbinlinkissue3918 messages
2008-09-21 03:36:53xuinkrbincreate