Randomize Function!

Results 1 to 3 of 3

Thread: Randomize Function!

  1. #1
    Join Date
    Dec 1969

    Default Randomize Function!

    Can someone please expain how the randomize function works?<BR>I&#039;m trying to randomize a number between 1 and 500 and insert it into a variable ..

  2. #2
    Join Date
    Dec 1969

    Default RE: Randomize Function!

    To produce random integers in a given range, use this formula: <BR><BR>Int((upperbound - lowerbound + 1) * Rnd + lowerbound)<BR>Here, upperbound is the highest number in the range, and lowerbound is the lowest number in the range.<BR><BR>Note To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence.<BR><BR><BR><BR>this is straight out of the vbscript documents..<BR><BR>give it a look over.

  3. #3
    Join Date
    Dec 1969

    Default Randomize is *NOT* a function...

    Randomize is a *statement*. It tells the system to initialize the random number generator. It can *NOT* be used as a function. It can *NOT* be used to get a random number. It&#039;s ONLY purpose is to "start things up."<BR><BR>Rnd *is* a function. <BR><BR>So:<BR><BR>&#060;%<BR>Randomize<BR>myRando mNumber = 1 + Int( Rnd() * 500 )<BR>%&#062;<BR><BR>Following the VBS docs, as quoted by prior answer here.<BR><BR>

Posting Permissions

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