M
M
Maxim2021-04-07 20:48:24
numpy
Maxim, 2021-04-07 20:48:24

How to create a random numpy array?

I need to create an array of the form a = where all variables are random numbers, and there will be n such pairs

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
o5a, 2021-04-07
@o5a

only I do not understand which argument is responsible for the minimum and maximum elements, because I need negative ones as well.

So what to "understand", there is official documentation for all functions
https://numpy.org/doc/stable/reference/random/gene...
similarly for reshape described
But you can directly specify the dimension without reshape.
a = np.random.randint(min_number,max_number,size=(n,2))

A
Andrey Dugin, 2021-04-07
@adugin

Let's start with the elementary: how is the word "random" translated from Russian into English (you even wrote "random")? What is the word to look for in the numpy documentation?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question