To generate a random character between A and Z, you can write this code:
code = 64 + Math.GetRandomNumber(26)
char = Text.GetCharacter(code)
The computer uses numbers to represent the different characters (with the Text object). The letter A is 65, B is 66, C is 67, and so on until Z, which is 100.
Math.GetRandomNumber(26) gives you a random number between 1 and 26.
If you add 64 to this number, you’ll get a random number between 65 and 100. When you pass this number to Text.GetCharacter(), you’ll get the letter that represents the number.
You can then display the letter or do anything you want to it (maybe ask the user to guess it!).
Leave a comment if you have any questions!
Head to http://blogs.msdn.com/SmallBasic to download it and learn all about it!
Small and Basically yours,
– Ninja Ed & Majed Marji