Last semester for a VB class I took, we had to program a Visual Basic Tic-Tac-Toe without any help from the teacher. I established myself with getting the Tic-Tac-Toe to work, but we needed to have a random start, either computer or human first. So heres what I got.
That worked just fine for the started, but now I needed to randomize where the computer started. And I found out Rnd only generates a random number 0-1. How would I generate 0-8?
Dim iStart as Integer
iStart = Rnd
If you look up the Rnd function in VB's online help, you'll find an example of how to generate a random number in a given range. VB's online help is also available on MSDN, so if you search Google for "rnd given range", you can find what you're looking for.
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
i think it is:
Dim I As Integer
I = int(1 + rnd * 8)
Last edited by XRsTX; 03-14-2005 at 12:30 AM.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center