import matplotlib.pyplot as plt import numpy as np import random as ra antall = 20 alle_kast = np.zeros(antall) for i in range(antall): to_seksere = 0 kast = np.array([]) while to_seksere < 2: tall = ra.randint(1,6) kast = np.append(kast, tall) if tall == 6: to_seksere += 1 if to_seksere == 2: alle_kast[i] = np.size(kast) x_val = np.linspace(1, antall, antall) plt.xticks(x_val) plt.bar(x_val, alle_kast) # plt.savefig('terningkast.pdf') plt.show()