Results 1 to 4 of 4

Thread: Randomize

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    55
    how do i get a randomize number?

  2. #2
    Lively Member
    Join Date
    Jun 2000
    Posts
    80
    Rnd Function Example
    This example uses the Rnd function to generate a random integer value from 1 to 6.

    Dim MyValue
    MyValue = Int((6 * Rnd) + 1) ' Generate random value between 1 and 6.


  3. #3
    Addicted Member
    Join Date
    Apr 2000
    Location
    Sheffield, England.
    Posts
    136
    Code:
    Dim Num as Long
    Dim MaxRange as Long
    
    MaxRange = 2000
    
    Num = Int(Rnd(1) * MaxRange)
    In this case, Num would contain a value between 0 and 2000.
    Visual Basic 6 Enterprise Edition + SP4

  4. #4
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    nb. Use the Randomize statement before using Rnd()
    Iain, thats with an i by the way!

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