RndRange
RandomInteger = RndRange(StartRange, EndRange)
 
Parameters:

    StartRange = The lower limit value that the random number is selected within.
    EndRange = The upper limit value that the random number is selected within.
Returns:

    RandomInteger = The random number selcted by the RndRange function
 

      The RndRange function will return a random number between the lower and upper range limits selected The random number it chooses is inclusive of the lower and upper range values, so their both possible outputs of the function. Each time you use the RndRange function it will return a different result.

      While RndRange may appear to produce random results to us humans, but the results are in fact part of a 'set'. While the sets of numbers it will produce are in the millions however, so it's unlikely you'll noticed any repeating, they do in fact repeat. This is not a PlayBASIC issue, it's an issue with how random number generation techniques employed in computers..



FACTS:


      * The value returned by the RndRange function is inclusive of lower/upper range limits.

      * See Randomize to seed the random number generator



Mini Tutorial:


Displaying a list of 10 random numbers between 50 and 100 (inclusive)

  
  For lp=1 To 10
   ; display a random number between 0 and 100
     Print RndRange(50,100)
  Next
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  



This example could output something like this. (could as it'll be random set of results each time you run the program)

  
  66
  50
  77
  99
  100
  55
  67
  87
  91
  




 
Related Info: Randomize | Rnd | Rnd# | RndRange# :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com