chi-square
Chi-square distribution calculator.
npm install chi-square
Want to see pretty graphs? Log in now!
2 | downloads in the last week |
4 | downloads in the last month |
Maintainers | |
---|---|
Version | 0.0.1 last updated 2 years ago |
License | MIT |
Keywords | χ², chi, distribution, probability, mathematics, chi square |
Repository | http://github.com/kaisellgren/ChiSquare.git (git) |
Dependencies | None |
Starred by | fgribreau |
Chi-Square
Calculates a Chi-square distribution over a sequence of bytes within a Buffer.
The result is a float representing the probability of how frequently a truly random sequence of bytes would exceed the calculated value.
Ideally this float should have a value of 0.5. If so, the given Buffer contained random data.
Read on Chi-square distribution for more details.
Installation
npm install chi-square
Examples
var chiSquare = require('chi-square'),
crypto = require('crypto');
crypto.randomBytes(1024 * 1024, function(err, buffer) {
if (err) throw err;
console.log('The chi square distribution over the random data sequence was: %d', chiSquare.calculate(buffer));
});
The output was:
The chi square distribution over the random data sequence was: 0.16175185384825533
License
The library is licensed under MIT.