![](/img/trans.png)
[英]Can I generate random matrix value (decimals) in Python which the equal of each rows equal to 1?
[英]How can I generate in Python a matrix with n random elements between 1 and 30 and the rest of the elements equal to zeros?
我必须生成一个形状为 10^4 x 10^4 的矩阵,其中 100 个 integer 项目随机选择 1 和 30,元素的 rest 等于 0。有人可以帮我吗? :祈祷
用零创建矩阵,然后添加随机数,或者创建一个空矩阵,添加随机数,然后用 0 填充空值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.