View Single Post
Old May 13th, 2008, 9:52 AM   #20
Fall Back Son
Professional Programmer
 
Join Date: Oct 2006
Posts: 257
Rep Power: 2 Fall Back Son is on a distinguished road
Re: Random "Letter" Generator

double number = Math.round((Math.random() * 100));
char a = (char)(number);
System.out.println(a);


Yes... if you force it within the correct range, you can generate a letter between A-J only using Math.random() and converting it to char. The code I provided above isn't in the correct range, but it demonstrates what I mean. I hope I'm not overlooking something else in your code that requires the array. But just a thought.
Fall Back Son is offline   Reply With Quote