- #1
gamow99
- 71
- 2
I'm trying to write a computer program which generates a random list of numbers but the random numbers form a bell curve, that is, there is a mean and a standard deviation from that mean. I'm not interested in some function that gets the job done, rather I'm trying to understand how do you generate a random list of numbers which are not entirely but conform to a bell curve. I have already done the following in Python:
list5 = [5] * 8
list4 = [4,5,6] * 4
list3 = [3,4,5,6,7] * 2
list2 = [x for x in range(2,9)]
list1 = [x for x in range(1,11)]
list6 = list1 + list2 + list3 + list4 + list5
So in the above 5 appears 8 times more often often 1,2,9,10. 4 times more often than 3 and 4 and twice as often as 4 and 6 which does form a bell curve and then I just select randomly from list 6. But I don't like that solution.
list5 = [5] * 8
list4 = [4,5,6] * 4
list3 = [3,4,5,6,7] * 2
list2 = [x for x in range(2,9)]
list1 = [x for x in range(1,11)]
list6 = list1 + list2 + list3 + list4 + list5
So in the above 5 appears 8 times more often often 1,2,9,10. 4 times more often than 3 and 4 and twice as often as 4 and 6 which does form a bell curve and then I just select randomly from list 6. But I don't like that solution.