#!/bin/sh # check that a series of random numbers is normal by computing and printing: # the mean (should be 0.0) # the variance (should be 1.0) # the count within one standard deviation (should be 68.3%) # the count within two standard deviations (should be 95.4%) awk ' {sum += $1; sum2 += $1 * $1;} $1 >= -1 && $1 <= 1 {w1 ++;} $1 >= -2 && $1 <= 2 {w2 ++;} END {print sum / NR, (sum2 * NR - sum * sum) / NR / NR, w1 / NR, w2 / NR;} ' "$@"