Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> random return a random number pp 143</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 RANDOM                     Return a Random Number                    pp 143

 Syntax:  Random <IntVar> ;

 Type:    Integer or Real

 Form:    Function

 Purpose: Return a random number of type Real or type Integer.

 Notes:   Random used without the optional IntVar returns a Real number
          that is greater than or equal to 0 and less than 1.

          When called with the optional IntVar, an integer number greater
          than or equal to zero and less than IntVar is returned.

 ----------------------------------------------------------------------------



 Usage:
       VAR
          IntVar  : Integer     ;  { Integer variable }
          RealVar : Real        ;  { Real variable }

       BEGIN
          RealVar := Random     ;  { 1 > RealVar >= 0 }
          IntVar  := Random (4) ;  { 4 > IntVar  >= 0 }
       END.

See Also: Randomize

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson