【random.uniform()】是随机分布

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wangdongwei0/article/details/88727005
import numpy as np
import random
import matplotlib.pyplot as plt

L = list(range(33, 170, 1))

l = [a/10 for a in L]

ll = [0]*100
for i in range(1000000):
    x = round(random.uniform(0, 99))
    ll[x] = ll[x] + 1
    
plt.plot(list(range(100)), ll)

猜你喜欢

转载自blog.csdn.net/wangdongwei0/article/details/88727005
今日推荐