[Numpy-discussion] random integers

Charles R Harris charlesr.harris at gmail.com
Thu Dec 31 00:31:37 EST 2015


Hi All,

I've implemented several new random integer functions in #6910
<https://github.com/numpy/numpy/pull/6910>, to wit


   - np.random.random_int32
   - np.random.random_int64
   - np.random.random_intp

These are the minimum functions that I think we need for the numpy 1.11.0
release, most especially the random_intp function for fuzz testing the
mem_overlap functions. However, there is the question of the best way to
expose the functions. Currently, they are all separately exposed, but it
would also be possible to expose them through a new dtype argument to the
current np.random.random_integers function. Note that all all the new
functions would still be there, but they could be hidden as private
functions. Also, there is the option of adding a complete set comprising
booleans, int8, int16, and the unsigned versions. So the two, not mutually
exclusive, proposed enhancements are

   - expose the new functions through a dtype argument to random_integers,
   hide the other functions
   - expose the new functions through a dtype argument to random_integers,
   not hide the other functions
   - make a complete set of random integer types

There is currently no easy way to specify the complete range, so a proposal
for that would be to generate random numbers over the full possible range
of the type if no arguments are specified. That seems like a fairly natural
extension.

Finally, there is also a proposal to allow broadcasting/element wise
selection of the range. This is the most complicated of the proposed
enhancements and I am not really in favor, but it would be good to hear
from others.

Thoughts?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20151230/87f6884d/attachment.html>


More information about the NumPy-Discussion mailing list