bas7advr.hlp (Topic list)
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.
RND Function Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
RND returns a single-precision number between 0 and 1.
 
RND[(n#)]
 
Usage Notes
    ■ The value of n# determines how RND generates the next random number:
 
          Argument         Number returned
          ══════════════   ═══════════════════════════════════════════════
          n# < 0            Always returns the same number for any given n#.
          n# > 0 or         Returns the next random number in the sequence.
          n# omitted
          n# = 0            Returns the last number generated.
 
    ■ Even if n# > 0, the same sequence of random numbers is generated each
      time the program is run unless you initialize the random-number
      generator each time. (See the RANDOMIZE statement for more information
      about initializing the random-number generator.)
    ■ To produce random integers in a given range, use this formula,
 
          INT ((upperbound - lowerbound + 1)*RND + lowerbound)
 
      In this formula, upperbound is the highest number in the range, and
      lowerbound is the lowest number in the range.