Simple way to create matrix of random numbers

前端 未结 13 1691
灰色年华
灰色年华 2020-12-12 21:20

I am trying to create a matrix of random numbers, but my solution is too long and looks ugly

random_matrix = [[random.random() for e in range(2)] for e in ra         


        
13条回答
  •  佛祖请我去吃肉
    2020-12-12 22:07

    use np.random.randint() as np.random.random_integers() is deprecated

    random_matrix = np.random.randint(min_val,max_val,(,))
    

提交回复
热议问题