Results 1 to 3 of 3

Thread: random numbers

  1. #1

    Thread Starter
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    The Rnd function will return a random number between 0 and 1. If you want an integer between say 1 and 10 inclusive then you would do this:

    Code:
    RandomNum = Int(Rnd * 10) + 1
    So for your list, it depends on how you are storing your list. If you have it in an array then just use a random array index, like this:

    Code:
    RandomWord = WordsArray(RandomIndex)
    Harry.

    "From one thing, know ten thousand things."

  2. #2

    Thread Starter
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Oh yes and at the start of your program you should add this line:

    Code:
    Randomize Timer
    To seed the random function with a starting value, taken form the system timer.
    Harry.

    "From one thing, know ten thousand things."

  3. #3
    New Member
    Join Date
    Dec 2000
    Posts
    10

    Cool

    randomize timer
    wordnumber = int(rnd * x)+1
    if wordnumber = ____ then word = ____


    If u understand this it should work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width