Help us understand the problem. What is going on with this article?

# 乱数の配列を生成する

numpy.randomモジュールに乱数に関する沢山の関数がある

# numpy.random.rand()

0.0以上1.0未満の乱数を作成する

```import numpy as np
a=np.random.rand()
print(a)
```

```0.13897360580695584
```

()の中を空にすると1つの乱数を作成する

```a1=np.random.rand(2)
print(a1)
```

```array([0.57013166, 0.68758734])
```

()の中を2にしたことで(1×2)行列を作成できる

```a2=np.random.rand(2,2)
print(a2)
```

```array([[0.66449092, 0.02173986],
[0.4008564 , 0.08414578]])
```

(2,2)にすることで(2×2)行列を作成できる

# numpy.random.randint()

```a3=np.random.randint(1,10,(2,2))
#(low, high,size)
print(a3)
```

```array([[3, 2],
[2, 4]])
```

a3は1以上10未満の2×2の配列の整数乱数を作成する

# numpy.random.randn()

```a4=np.random.randn(3,3)
print(a4)
```

```array([[-0.36698874, -1.18990918, -0.29731787],
[ 0.63560529,  1.42710657,  1.09983835],
[-0.75945298,  1.34462223,  0.72328678]])
```
Why not register and get more from Qiita?
1. We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
2. you can read useful information later efficiently
By "stocking" the articles you like, you can search right away