# *_*coding:utf-8 *_* # athor:auto import numpy.random #rand(d0, d1, ..., dn)n维随机值 data0 = numpy.random.rand(3,2) print(data0) # [[ 0.32795061 0.57825984] # [ 0.29511226 0.64076698] # [ 0.3778223 0.23230085]] print('===========================') data1 = numpy.random.rand(3,2,2) print(data1) #[[[ 0.44952156 0.11168053] # [ 0.87637963 0.24573856]] # [[ 0.67938412 0.95292638] # [ 0.13807601 0.77882787]] # [[ 0.53388344 0.98088418] # [ 0.17200354 0.81483477]]]
这个numpy.random函数相当于可以构造一个多维的数组