Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
RANDOMIZE Statement, RND Function Details
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
RANDOMIZE [seed]
RND[(n)]
Usage Notes
■ If the random-number generator is not reseeded, the RND function returns
the same sequence of random numbers each time the program is run. To
avoid this, place a RANDOMIZE statement at the beginning of the program
loop and change the argument with each iteration.
■ A convenient way to initialize the random-number generator is to use the
TIMER function. Using TIMER ensures a new series of random numbers.
See: ◄TIMER Function►
■ To produce random integers in a given range, use this formula:
INT ((upperbound - lowerbound + 1)*RND + lowerbound)
where upperbound is the highest number in the range, and lowerbound is
the lowest number in the range.