How would i go about making a random string?

EDIT: I think a random Char would be more useful

We have random floats and integers but how would i generate a random string (basically a jumbled word from random) and of a certain length.

Any advice would be appreciated.

You’d probably be better off doing this in C++, but what it boils down to is:

You have an array of 26 characters (a-z), and you iterate through your word-length and append a character from the array by picking a random number between 0-25.

Here’s a working blueprint:

In case it isn’t obvious, the high index in the ForLoop is your letter count. Just bear in mind your max index will be wordlength-1

For a 6 character string:

LogBlueprintUserMessages: Generating...
LogBlueprintUserMessages: mwldqz

LogBlueprintUserMessages: Generating...
LogBlueprintUserMessages: ffbhpt

LogBlueprintUserMessages: Generating...
LogBlueprintUserMessages: ndicrc

Thanks for all your help, this was all to create a randomized registration plate for my vehicle on begin play, here is what i ended up with,

I wanted the length to be 5 so i entered 0-4 on the loop as it’s zero indexed.

Yeah that seems pretty solid. Just one thing I’d change in the interests of possible optimisation, would be to move the Set Text to fire off the ‘completed’ pin on the loop, so that you’re not updating it each time you iterate through your loop.

Thanks for the advice :slight_smile: