Now I have a good source of random numbers I can think about the program itself. What I want is a program which will cover the LCD with flickering characters which from which the answer to the question will magically emerge.

To do this I will obtain a random number and then use it to calculate a value for x, y and a character to be displayed. I will then position the cursor at that position and write the character.

The code I wrote is on the right. Note how I use the mod (%) operators to get values in the correct ranges. When I pick the random characters I use the fact that the ASCII character set has 128 printable values, and the printing characters are all after the space character - which has the code 32. This means that I must create a random number in the range 0 to 96 and then add the code for space to it.

Run project Exercise 6.2. Note how we get a nice flickering display.

If you need to refresh your memory about creating and running project files you should refer back to:
chapter 'Lab 5: LCDs and libraries
page
'Linkers and libraries'