So I need to be able to scramble numbers around but have the outcome always be consistent. Meaning, if I scrambled 1234 and it gave me something like 2143, if I ran the scramble function again it would result in 2143 again.
Is anyone aware of a way to do this?
Below is my inconsistent scrambling method.
function textScrambler(fieldText) {
var scramWord = '';
fieldText = fieldText.split('');
while (fieldText.length > 0) {
scramWord += fieldText.splice(fieldText.length * Math.random() << 0, 1);
}
return scramWord;
}
Aucun commentaire:
Enregistrer un commentaire