Nodejs Utililty Methods String Shuffle

List of utility methods to do String Shuffle

Description

The list of methods to do String Shuffle are organized into topic(s).

Method

shuffle()
String.prototype.shuffle = function ()
    var characters = this.split(''),
        iterations = (characters.length-1),
        i, j, tmp;
    for (i = iterations; i > 0; i--) {
        j = Math.floor(Math.random() * (i + 1));
        tmp = characters[i];
        characters[i] = characters[j];
...
shuffle()
'use strict';
String.prototype.shuffle = function () {
    var array = this.split('');
    for(var i = array.length - 1; i > 0; i--) {
        var j = Math.floor(Math.random() * (i + 1));
        var holder = array[i];
        array[i] = array[j];
        array[j] = holder;
    return array.join('');
};
shuffle()
String.prototype.shuffle = function () {
    var array = this.split('');
    var tmp, current, top = array.length;
    if (top) while (--top) {
        current = Math.floor(Math.random() * (top + 1));
        tmp = array[current];
        array[current] = array[top];
        array[top] = tmp;
    return array.join('');
};
shuffle()
String.prototype.shuffle = function() {
    var arr = this.arrayise();
    for (var i = arr.length - 1; i > 0; i--) {
        var randIndex = Math.floor(Math.random() * (i + 1));
        var temp = arr[i];
        arr[i] = arr[randIndex];
        arr[randIndex] = temp;
    return arr.join('');
...
shuffle()
String.prototype.shuffle = function () {
  var a = this.split(""),
    n = a.length;
  for(var i = n - 1; i > 0; i--) {
    var j = Math.floor(Math.random() * (i + 1));
    var tmp = a[i];
    a[i] = a[j];
    a[j] = tmp;
  return a.join("");
function createNewDocument() {
  var soup = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
    documentId = "",
    length = 6;
  soup = soup.shuffle();
  while( documentId.length < length ) {
    var pos = Math.floor( Math.random() * soup.length ) + 1
    documentId += soup.charAt( pos );
  window.location.href = "/edit/" + documentId;
};