G Young
2016-02-17 15:01:38 UTC
Hello all,
I have a PR open here <https://github.com/numpy/numpy/pull/7151> that makes
"low" an optional parameter in numpy.randint and introduces new behavior
into the API as follows:
1) `low == None` and `high == None`
Numbers are generated over the range `[lowbnd, highbnd)`, where `lowbnd =
np.iinfo(dtype).min`, and `highbnd = np.iinfo(dtype).max`, where `dtype` is
the provided integral type.
2) `low != None` and `high == None`
If `low >= 0`, numbers are <b>still</b> generated over the range `[0,
low)`, but if `low` < 0, numbers are generated over the range `[low,
highbnd)`, where `highbnd` is defined as above.
3) `low == None` and `high != None`
Numbers are generated over the range `[lowbnd, high)`, where `lowbnd` is
defined as above.
The primary motivation was the second case, as it is more convenient to
specify a 'dtype' by itself when generating such numbers in a similar vein
to numpy.empty, except with initialized values.
Looking forward to your feedback!
Greg
I have a PR open here <https://github.com/numpy/numpy/pull/7151> that makes
"low" an optional parameter in numpy.randint and introduces new behavior
into the API as follows:
1) `low == None` and `high == None`
Numbers are generated over the range `[lowbnd, highbnd)`, where `lowbnd =
np.iinfo(dtype).min`, and `highbnd = np.iinfo(dtype).max`, where `dtype` is
the provided integral type.
2) `low != None` and `high == None`
If `low >= 0`, numbers are <b>still</b> generated over the range `[0,
low)`, but if `low` < 0, numbers are generated over the range `[low,
highbnd)`, where `highbnd` is defined as above.
3) `low == None` and `high != None`
Numbers are generated over the range `[lowbnd, high)`, where `lowbnd` is
defined as above.
The primary motivation was the second case, as it is more convenient to
specify a 'dtype' by itself when generating such numbers in a similar vein
to numpy.empty, except with initialized values.
Looking forward to your feedback!
Greg