How to create a random matrix?

前端 未结 2 1827
执念已碎
执念已碎 2021-01-27 10:44

I want create a random matrix like [[[100, 50, 25], [22, 75, 195]]]

My code is

n = 1
r = 2
e = 3

sup = []

for i in range(n):
    sup1 = []
    for c         


        
2条回答
  •  广开言路
    2021-01-27 11:01

    This should work (No idea what e does):

    sup = [[random.randint(0, 200) for _ in range(r)] for _ in range(n)]
    

提交回复
热议问题