"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "numpy/random/mtrand.pyx" between
numpy-1.21.0.tar.gz and numpy-1.21.1.tar.gz

About: NumPy is the fundamental package for scientific computing with Python.

mtrand.pyx  (numpy-1.21.0):mtrand.pyx  (numpy-1.21.1)
skipping to change at line 797 skipping to change at line 797
out : bytes out : bytes
String of length `length`. String of length `length`.
See Also See Also
-------- --------
Generator.bytes: which should be used for new code. Generator.bytes: which should be used for new code.
Examples Examples
-------- --------
>>> np.random.bytes(10) >>> np.random.bytes(10)
' eh\\x85\\x022SZ\\xbf\\xa4' #random b' eh\\x85\\x022SZ\\xbf\\xa4' #random
""" """
cdef Py_ssize_t n_uint32 = ((length - 1) // 4 + 1) cdef Py_ssize_t n_uint32 = ((length - 1) // 4 + 1)
# Interpret the uint32s as little-endian to convert them to bytes # Interpret the uint32s as little-endian to convert them to bytes
# consistently. # consistently.
return self.randint(0, 4294967296, size=n_uint32, return self.randint(0, 4294967296, size=n_uint32,
dtype=np.uint32).astype('<u4').tobytes()[:length] dtype=np.uint32).astype('<u4').tobytes()[:length]
@cython.wraparound(True) @cython.wraparound(True)
def choice(self, a, size=None, replace=True, p=None): def choice(self, a, size=None, replace=True, p=None):
""" """
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)