Skip to content

Instantly share code, notes, and snippets.

@ZakharDay
Last active December 27, 2022 16:26
Show Gist options
  • Save ZakharDay/eeed2c389a62f3d25c0de17fbbe16156 to your computer and use it in GitHub Desktop.
Save ZakharDay/eeed2c389a62f3d25c0de17fbbe16156 to your computer and use it in GitHub Desktop.
function generateHash() {
const symbols = ['a', 'b', 'c', 'd', 'e', 'f', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
let hash = ''
for (var i = 0; i < 6; i++) {
hash += sample(symbols)
}
return hash
}
function sample(array) {
return array[Math.floor(Math.random() * array.length)]
}
export { generateHash }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment