Hi,
Is it possible to get the average of all the integers in a list? I have a list of 256 integers (it’s a histogram from Photoshop), and I’d like to add them all and divide by 256 to get the average.
Thanks.
Hi,
Is it possible to get the average of all the integers in a list? I have a list of 256 integers (it’s a histogram from Photoshop), and I’d like to add them all and divide by 256 to get the average.
Thanks.
--using Akua Sweets
set histoList to {25, 75, 35, 44, 10, 9, 71, 66, 42, 16, 101}
set akuaAvg to the statistical list average from histoList
--Standard Additions only
set histoList to {25, 75, 35, 44, 10, 9, 71, 66, 42, 16, 101}
set divideBy to the number of items in histoList
set theSum to 0
repeat with thisItem in histoList
set theSum to theSum + (thisItem as integer)
end repeat
set theAverage to round (theSum / divideBy) rounding up --or down, or to nearest
Using Akua Sweets was all I needed. Thanks. 8)