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:
- 11105630
- 11110535
- 11112084
- 11113667
- 11120216
- 11106549
- 11108623
- 11114813
- 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.