Skip to content

Instantly share code, notes, and snippets.

@mrpotatoes
Last active July 23, 2022 13:23
Show Gist options
  • Save mrpotatoes/cebf6359705fe91ff491643cbb6b5e8d to your computer and use it in GitHub Desktop.
Save mrpotatoes/cebf6359705fe91ff491643cbb6b5e8d to your computer and use it in GitHub Desktop.
A cheap hash function
console.clear()
// https://www.codegrepper.com/code-examples/javascript/javascript+generate+unique+hash
const hash = (len) => '_' + Math.random().toString(len).substr(2, 9)
const hashes = (amount = 5, hashLength = 36) => new Array(amount).fill().map(e => hash(hashLength))
console.log(hashes(100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment