function getRandom(arr, seed) { var rand = gen.create(seed); return arr[Math.floor(rand.random() * (arr.length - 1))]; }
const scrambleWord = (word) => { if (word.length <= 3) { return word; } const random = create(word.toLowerCase()); const newWord = word.split(''); const firstLetter = newWord.shift(); const lastLetter = newWord.pop(); for (let i = 0; i < word.length; i += 1) { const from = random(word.length); const to = random(word.length); newWord.splice(to, 0, newWord.splice(from, 1)[0]); } newWord.unshift(firstLetter); newWord.push(lastLetter); return newWord.join(''); }