A quick test to show that Benford's Law does not work for data that is random numbers. It does however work very well for data which is generated following a power law.
https://en.wikipedia.org/wiki/Benford%27s_law
main.go | ||
README.md |
benfords-law
This was a test to determine if random numbers follow Benford's Law. I suspect it has more to do with the distribution real life data collected from than truly random numbers. If this is true, maybe this is why it works for fraud detection.
Results
With One-Hundred-Million samples of random numbers between 0 and 9,999,999,999,999,999, the number of leading digits was the following:
1: 11105630 2: 11110535 3: 11112084 4: 11113667 5: 11120216 6: 11106549 7: 11108623 8: 11114813 9: 11107883
This shows that Benford's law only works when the data is not random, such as natural data gathered in real life. This is because natural data is generated following a power law, which is common in nature.