I'm in stats class right now and I wanted to know if it makes a difference if you generate a number each digit at a time vs every digit at once, so I wrote some code...
from random import randint
import math
total1 = 0
total2 = 0
for i in range(100000):
temp = 0
for j in range(7):
temp += randint(0,9)*math.pow(10,j)
total1 += temp
total2 += randint(0,9999999)
print "avg1 = ", total1/100000
print "avg2 = ", total2/100000
When I ran the code, avg1 was always a decimal and avg2 was always a whole number. I don't understand why total1 is being considered as a double since I only ever added integers to it...