
On Tue, Jan 19, 2016 at 5:40 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
On Tue, Jan 19, 2016 at 10:36 AM, Robert Kern <robert.kern@gmail.com>
On Tue, Jan 19, 2016 at 5:27 PM, Charles R Harris <
charlesr.harris@gmail.com> wrote:
On Tue, Jan 19, 2016 at 9:23 AM, Chris Barker - NOAA Federal < chris.barker@noaa.gov> wrote:
What does the standard lib do for rand range? I see that randint Is
closed on both ends, so order doesn't matter, though if it raises for b<a,
wrote: then that's a precedent we could follow.
randint is not closed on the high end. The now deprecated
random_integers is the function that does that.
For floats, it's good to have various interval options. For instance,
in generating numbers that will be inverted or have their log taken it is good to avoid zero. However, the names 'low' and 'high' are misleading...
They are correctly leading the users to the manner in which the author intended the function to be used. The *implementation* is misleading by allowing users to do things contrary to the documented intent. ;-)
With floating point and general intervals, there is not really a good way to guarantee that the generated results avoid the "open" end of the specified interval or even stay *within* that interval. This function is definitely not intended to be used as `uniform(closed_end, open_end)`.
Well, it is possible to make that happen if one is careful or directly sets the bits in ieee types...
For the unit interval, certainly. For general bounds, I am not so sure. -- Robert Kern