Yes there is. What was your try to accomplish that?
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Oke but what did you code to exclude those characters?
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
final String[] alphabet = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z"}; // all but and O
char index = (char)(Math.random() * alphabet.length + 'A');
Campbell Ritchie wrote:I would suggest you create an array with the desired characters in, and use the length of that array as the multiplicand for random().
Isn't that what I did, only with a String instead of a char[]?
pallavi chaudhari wrote:
Rob Spoor wrote:Which may cause the same two, unwanted characters to be generated each time. It's unlikely but still possible.
A simple way to solve this:
I am not getting how it will generate unwanted characters?
It will not, but I thought you didn't want the I and O to be generated?