Skip to content

Instantly share code, notes, and snippets.

View chandru89new's full-sized avatar

druchan chandru89new

View GitHub Profile
@jabney
jabney / entropy.js
Last active August 26, 2025 23:46
Javascript implementation of a Shannon entropy calculation in bits per symbol
// entropy.js MIT License © 2014 James Abney https://github.com/jabney
/***************************************
* ES2015
***************************************/
// Shannon entropy in bits per symbol.
function entropy(str) {
const len = str.length