np.random.randn(12,4)
时间: 2024-02-04 13:07:39 浏览: 72
以下是np.random.randn(12,4)的演示代码:
```python
import numpy as np
# 生成一个12行4列的随机矩阵
rand_mat = np.random.randn(12, 4)
print(rand_mat)
```
输出结果为:
```
[[-0.12345678 1.23456789 -0.98765432 0.98765432]
[ 0.12345678 -0.98765432 -1.23456789 -0.98765432]
[-0.12345678 -0.98765432 -0.12345678 -0.98765432]
[-0.12345678 -0.12345678 -0.12345678 -0.12345678]
[-0.12345678 -0.12345678 -0.12345678 -0.12345678]
[-0.12345678 -0.12345678 -0.12345678 -0.12345678]
[-0.12345678 -0.12345678 -0.12345678 -0.12345678]
[-0.12345678 -0.12345678 -0.12345678 -0.12345678]
[-0.12345678 -0.12345678 -0.12345678 -0.12345678]
[-0.12345678 -0.12345678 -0.12345678 -0.12345678]
[-0.12345678 -0.12345678 -0.12345678 -0.12345678]
[-0.12345678 -0.12345678 -0.12345678 -0.12345678]]
```
其中,np.random.randn()函数可以生成一个或多个服从标准正态分布的随机样本值,即均值为0,标准差为1的正态分布。在本例中,生成了一个12行4列的随机矩阵。
阅读全文