samedi 21 février 2015

how to get random numbers with only one standard deviation in python

I want to generate random numbers, lets say 100. Now I am using numpy for the purpose like:



print numpy.random.normal(loc=200,scale=50,size=100)


But I want the numbers to be generated only one standard deviation apart from the mean value i.e loc. What would be the best way ?


Should I simply do something like:



print numpy.random.randint(150, high=250, size=100)


or is there any other way of doing it ?





Aucun commentaire:

Enregistrer un commentaire