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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
import numpy
import matplotlib.pyplot as plt
max = 10000
loop = 10000
size = 1000
count_1 = numpy.zeros(max+1)
count_2 = numpy.zeros(max+1)
for i in range(1, loop+1):
#print(i)
array_1 = numpy.random.randint(1, max+1, size)
for nb in array_1:
#print(nb)
count_1[nb]=count_1[nb]+1
tmp_seq = numpy.arange(1, max+1)
numpy.random.shuffle(tmp_seq)
array_2 = tmp_seq[:size]
for nb in array_2:
#print(nb)
count_2[nb]=count_2[nb]+1
for nb in range(1, max+1):
#print(nb)
count_1[nb]=count_1[nb]/loop
count_2[nb]=count_2[nb]/loop
count_1=count_1[1:]
count_2=count_2[1:]
print("matrice1")
print("moyenne="+str(numpy.mean(count_1)))
print("ecart-type ="+str(numpy.std(count_1)))
print("min = "+str(numpy.min(count_1)))
print("minvalue = "+str(numpy.argmin(count_1)))
print("max = "+str(numpy.max(count_1)))
print("maxvalue = "+str(numpy.argmax(count_1)))
print("amplitude = "+str(numpy.max(count_1)-numpy.min(count_1)))
print("matrice2")
print("moyenne="+str(numpy.mean(count_2)))
print("ecart-type ="+str(numpy.std(count_2)))
print("min = "+str(numpy.min(count_2)))
print("minvalue = "+str(numpy.argmin(count_2)))
print("max = "+str(numpy.max(count_2)))
print("maxvalue = "+str(numpy.argmax(count_2)))
print("amplitude = "+str(numpy.max(count_2)-numpy.min(count_2))) |
Partager