Let's assume you have a numpy
array that represents your random numbers
rnd_numb=array([ 0.48942231, 0.48536864, 0.48614467, ..., 0.47264172,
0.48309697, 0.48439782])
In order to create a histogram you only need to bin your data. So let's create an array that defines the binning
bin_array=linspace(0,1,100)
In this case we're creating 100 linearly spaced bins in the range 0 to 1
Now, in order to create the histogram you can simply do
my_histogram=[]
for i in range(len(bin_array)-1):
mask = (rnd_numb>=bin_array[i])&(rnd_numb<bin_array[i+1])
my_histogram.append(len(rnd_numb[mask]))
This creates a list that contains the counts in each bin. Lastly, if you want to visualize your histogram you can do
plot ((bin_array[1:]+bin_array[:-1])/2.,my_histrogram)
you can also try step
or bar
.