1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| import random
i=0
Liste=[]
for i in range (0,79):
r=random.randint(1,100)
Liste.append (r)
Listec=[]
c=random.randint(1,100)
def rech_cle(cle,Liste):
for j in range(0,79):
if Liste[j]==cle:
j=j+81
Listec.append(j)
break
if j==79:
if Liste[79]!=cle:
j=161
Listec.append(j)
Listec=[]
for l in range (1,205):
h=random.randint(1,100)
rech_cle(h,Liste)
print Listec
import matplotlib.pyplot as plt
x = [Listec[i] for i in range (0,100)]
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='b')
plt.xlabel(u'Nb de clés diff')
plt.ylabel(u'Complexite')
plt.axis([1, 100, 81, 161])
plt.grid(True)
plt.show() |
Partager