the random character should be uppercase letter
A to Z is from 65 to 90 in the asii table
what is the equation....?

Well actually java Random class uses System.currentTimeMillis() for seeding the Random number. So you can copy that code..

Here is the source code:

int next(int bits)
{
   seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
   return (int) (seed >>> (48 - bits));
}

This will return a random number of size 32 bits (an integer).

So you need the value between 65 and 90.

So u get a random number from above method and add 65 to it. and mod it by 91. Then your number will be between 65 and 91. Then cast it to a character

Well, too avoid all this clutter u can directly use the Random class. Thats the Java Spirit.

http://java.about.com/od/javautil/a/randomnumbers.htm

generate an int between 65 and 90 and cast to character. Thats all....


BTW, may I know why u wanted the equation? for using in your code or for just knowing or are u doing an assignment where you are not supposed to use library classes?