0

SO far, I have this:

function permutate(UwU){
    let array = [];
    for (let i = 0; i < UwU.length; i = i + 1) {
        let slice = permutate(UwU.slice(0, i).concat(UwU.slice(i + 1)));
    
        if(!slice.length) {
            array.push([UwU[i]])
        } else {
          for(let j = 0; j < slice.length; j = j + 1) {
            array.push([UwU[i]].concat(slice[j]))
          }
        }
      }
      return array;
    }
const array = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "P", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]

   const overload = permutate(["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "P", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]).join("\n")
   console.log(overload)

Obviously there's way too many variations, so how would I pick like 100 random ones or something?

imvain2
  • 15,480
  • 1
  • 16
  • 21

0 Answers0