RndRange#
Result# = 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:

    Result# = 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)

  
  88.1401
  50.7486
  85.4401
  98.2615
  93.1178
  74.2291
  95.1892
  62.9322
  61.3324
  60.3437
  




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


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