0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

numpyで値の範囲を指定した乱数行列の生成

Last updated at Posted at 2019-04-04

例えば「-10.0 から 10.0 までの範囲の一様乱数で構成された 2×3の行列を生成する」といった処理をしたかったら、

>>> 20 * np.random.random((2,3)) -10
array([[ 0.05083841,  5.67039253,  4.40987912],
       [-7.21727498,  3.29485038,  9.83926988]])

とする。
最初の20は値の範囲(-10~+10だから20)で、最後の-10は値の最小値。


参考: https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.random.html#numpy.random.random

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?