I want to make bogosort function. I want to invoke the bogo function each time the output is false. I tried with do {bogo function block} while(sorted===false) loop but looped only once (arr changed to empty array). The final goal is to invoke function f.e bogo([1,5,3,2]) and it should output sorted array (in variable shuffled). 
function bogo(arr) {
  function shuffle(arr) {
    var shuffled = [];
    var rand;
    while (arr.length !== 0) {
      rand = Math.floor(Math.random() * arr.length)
      shuffled.push(arr.splice(rand, 1)[0]);
    }
    return shuffled;
  }
  function sorted(shuffle) {
    for (var i = 0; i < shuffle.length - 1; i++) {
      if (shuffle[i] <= shuffle[i + 1]) {
        continue;
      } else {
        return false;
      }
    }
    return true
  }
  return sorted(shuffle(arr));
}
console.log(bogo([1, 2])); 
    