Here's one way to shuffle a string in Swift using the Fisher-Yates shuffle algorithm:
main.swift429 chars18 lines
In this code, we first convert the input string into an array of characters. Then, we loop through the array and randomly swap each character with another character in the array. Finally, we convert the shuffled array back into a string and output the result.
gistlibby LogSnag