dimanche 12 juillet 2020

plotting randint function result give me unexpected plot in python

I write a code that generates a random number between (0, 10) 100000 time and plot it, I expect the histogram to be flat but this what I got

import random 
import numpy as np
import matplotlib.pyplot as plt

numbers = []
for i in range(10000000):
    numbers.append(random.randint(0, 10))

plt.hist(numbers) 

plot result




Aucun commentaire:

Enregistrer un commentaire