+ 1
[Solved] Trying to shuffle a word
I'm trying to shuffle a word but sometimes the word gets shuffled back to the original, why is that? https://code.sololearn.com/cMRW6QYkJWLX/?ref=app
5 odpowiedzi
+ 2
Why not?
+ 2
You can print your index and see what your algorithm do.
+ 1
You are welcome.
0
JaScript
My apologies, I made it so the random index will never include the current index for each iteration until the index reaches 0, the letter that's not included will be swapped with the letter that's randomly chosen
0
JaScript
Will do, thanks for your response, have a good day.