require "table2" for {100, 1000, 10000} as i do local a = table.create(i) for j = 1, i do a[j] = math.random() end print($"For {i} random numbers:") print($" mean = {a:mean()}") print($" std/dev = {a:stddev()}") local scale = math.round(i / 100) print($" scale = {scale} per asterisk") local sums = table.rep(10, 0) for a as e do local f = math.floor(e * 10) sums[f + 1] += 1 end for j = 1, 9 do sums[j] = math.round(sums[j] / scale) print($" 0.{j - 1} - 0.{j}: {string.rep("*", sums[j])}") end sums[10] = 100 - sums:slice(1, 9):sum() print($" 0.9 - 1.0: {string.rep("*", sums[10])}\n") end