[SOLVED] Shuffle text (random)

Hello,
does exist a command to shuffle quickliy a text ?
Example:
Variable(TextHello).shuffle
or something similar ?

Thanks,
J

Hi,
I don’t think so.
There’s this:
image
And there’s the array extension which has some shuffling, maybe you can adapt it to your needs.
But IIRC, you know JS, and you should be able to find some snippet online for shuffling letters.

Thanks @Gruk ,
I have pasted from internet this code and it seems works well:

var sceneVarString = runtimeScene.getVariables().get(“MyVariableName”).getAsString();
var a = sceneVarString.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;
}
runtimeScene.getVariables().get(“MyVariableName”).setString(a.join(“”));

2 Likes