News for hackers. Stuff that matters.
Re:Why 30.1% of numbers start with 1 by revicon on Tuesday January 26, 2010 @06:30PM (#1079236)
Limiting to just files is a good idea, and if we employ our good friend awk it cuts the time down significantly. This one should work for both OSX and Linux.

find . -type f -ls | awk '{print $7}' | cut -c -1 | sort | uniq -c

Re:Why 30.1% of numbers start with 1 by fexl on Wednesday January 27, 2010 @10:28AM (#1080674)
MUCH faster, thanks.

Now I'm piping that into Perl to convert the counts to percentages. If I figure out a one-liner for that I'll let you know.

Next I'll be tempted to write a module for generating "realistic" (Benford-compliant) random numbers using this concise specification from HN contributor "shrughes":

"Data whose logarithm is uniformly distributed does [follow Benford's Law]."

I could use that to produce demo or test data.