title: Randomly space characters throughout string?
body: <p>To shuffle a string, I could use something like this</p>
  
  <pre><code>String.prototype.shuffle = function () {
      var arr = this.split("");
      var len = arr.length;
      for (var n = len - 1; n &gt; 0; n--) {
          m = Math.floor(Math.random() * (n + 1));
          tmp = arr[n];
          arr[n] = arr[m];
          arr[m] = tmp;
      }
      return arr.join("");
  }
  </code></pre>
  
  <p>But how could I randomly space it with <code>n</code> characters, while preserving the string order?</p>
  
  <p>For example:</p>
  
  <pre><code>"test"   =&gt;   "t-es--t"
  "test"   =&gt;   "-t-e-st"
  "test"   =&gt;   "te--st-"
  </code></pre>
  
  <p>I've thought about creating a list from the string, generating a random number to represent an index, and then shifting the list to the left, but is there a better way to do this?</p>