I found an script that will shuffle the string:
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("");
}
Using this script, following word:
What is the difference in between 'Apache Environment', 'Environment' and 'PHP Variables'?
will be shuffeled to this word on random basis:
ftewE'eim rasent VhiEAn'oeded ta ' mb one'ennfva'nbcr?n elcttpnP iaWePh'irH rshv ieinena,
However, I am wondering how to preserve original location of each space:
ftew E' eim rasentVhiE An 'oededt a'mbone 'ennfva'nbcr? nelcttpnPiaWe Ph' irHr shvieinena,