c=np.random.rand(10,2)
generates an array of random numbers from in [0,1)
. Can I generate the same array (in terms of size) but with negative AND positive numbers? Moreover, can I choose the limits and the dimension of this array? for example if I want from -2 to 2.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Use
np.random.randint
and pass thesize
parameter. For values in[-2, 2)
and size(10, 2)
you have:Or use
np.random.uniform
for floats: