So I am trying to make an anagram tool in java in which you insert a word/string, and it spits an anagram for that word. There probably easier or better ways to do this than I am about to show, but I am still curious. Here's what I wanted to do:
Lets say the Word is: apple
What I wanted to do is assign each character from that string a randomInt(100). So lets say as an example
a - 35, p - 54, p - 98, l - 75, e - 13
After that, I would want my program to sort the numbers from least to greatest, and then print the "new" string with the number's assigned character,least to greatest. In My case, the anagram would be: eaplp
All said and done, the place where I am stuck at is in how I can actually assign a character a random number from a string array, without actually changing that character into that number, and then printing that new modified string out like the way I said on top. Pseudocode or real code would be great.
Thanks