pub fn total_entropy<F: Float + FromPrimitive>(data: &[u8]) -> FExpand description
Calculates the total Shannon entropy of a byte slice.
Shannon entropy measures the average information content per byte, multiplied by the length this returns the total entropy of the byte slice.
§Arguments
data- A byte slice to analyze
§Returns
The total entropy of data
§Example
§Calculating total entropy of a String
use shannon::total_entropy;
let text = String::from("AABB");
let e = total_entropy::<f64>(text.as_bytes());
assert_eq!(e, 4.0);