ASCII characters are just numbers. So if you wanted onthe the upper case letters for example, the are 'A' thru 'Z', or 65 thru 90. So
1) limit your random value from 0 to 25 (number of letters)
2) add 'A' or 65 to it.
That will give you all the upper case letters.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
You can certainly mark the thread solved (that's a good thing -- thanks).
On the other hand, you could make your program work much better.
What you are doing is getting a random value between 0 and at least 32767. and you are looking for 65-90. Basically that means out of 1260 (32767/26) calls to the random function you will get a letter. To get your 10 letters, you'll have to get 12600 random values on average.
You can cut that down to getting 10 numbers with a little thought -- and searching these forums to find out how to make the random numbers fall between 65 and 90 on the first try.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944