计算N×M(建议维度大于100*100)的0,1矩阵均匀分布程度,值由0到1表示不均匀到均匀 import numpy as np def make_rand_matrix(side=20): # 制作随机矩阵,用于测试 a = np.random.random((side,side)) for i in range(0,side): for j in range(0,side): if a[i,j]>0.3: a[i,j] = 1 else: a[i,j] = 0 return a def g…