I have a string and I want to select random character from string.But I selected the character i choose won't be just one will select the entire string. I'm going to assign the ones I chose to different variables so chosen must be different.
From example like this but this code not working because same values come.
String s = "Hello";
int index = random.nextInt(s.length());
char x = s.charAt(index); // l
char y = s.charAt(index); // o
char z = s.charAt(index); // H
char w = s.charAt(index); // e
char q = s.charAt(index) // l
I'm really tried this algorithms but I can't make it.I'm new to Java so maybe there is something in java that will work for me on this subject.