Skip to content

Instantly share code, notes, and snippets.

@liuderchi liuderchi/shuffle.js
Created Jan 22, 2018

What would you like to do?
shuffle a string in js
function shuffle = (str) => str.split('')
.map((a) => ({sort: Math.random(), value: a}))
.sort((a, b) => a.sort - b.sort)
.map((a) => a.value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.