|
4 months ago | |
---|---|---|
.github | 5 months ago | |
spec | 5 months ago | |
src | 5 months ago | |
.editorconfig | 5 months ago | |
.gitignore | 5 months ago | |
.travis.yml | 5 months ago | |
LICENSE | 5 months ago | |
README.md | 4 months ago | |
shard.yml | 5 months ago |
A Crystal shard which provides a check if a number array confirms to the Benford's Law
Add the dependency to your shard.yml
:
dependencies:
benfordslaw:
github: cmiksche/benfordslaw.cr
Run shards install
require "benfordslaw"
Look at the tests for good examples. E.g.
test = BenfordsLaw::Check.new([1, 2, 3, 4, 5, 6, 7, 8, 9])
test.chiSquared.should eq(0.40105320411553363)
The BenfordsLaw::Check.chiSquared result is a float and describes how well Benford's Law was matched. Lower is better.
BenfordsLaw::Check.dist returns the distribution of the numbers 1 to 9 in the input array.
Run tests:
crystal spec
Format:
crystal tool format
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)