How can I make a word scrambler?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By khaylaaaa

I want to make a system where if the user inputs a word into a textEdit, it would scramble the word and output it. Thanks!

:bust_in_silhouette: Reply From: jgodfrey

Here’s a function that takes a string as input and returns a shuffled version of it.

func shuffle_string(s):
	var a = []
	for c in s: a.append(c)
	return "".join(a)

Call it like:

new_string = shuffle_string("shuffleme"))

Prints emfehulfs (for example)