Function entropy::shannon_entropy [] [src]

pub fn shannon_entropy(bytes: &[u8]) -> f32

Calculates the Shannon entropy of a byte string.

Examples

use entropy::shannon_entropy;

let h = shannon_entropy(b"hello, world");
assert_eq!(h, 3.0220551);