Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Nanforum Toolkit v2.1 Reference Guide - <b>ft_rand1()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FT_RAND1()
 Generate a random number
------------------------------------------------------------------------------

 Syntax

      FT_RAND1( <nMax> ) -> nRand

 Arguments

     <nMax>  Maximum limit of value to be produced.

 Returns

     nRand is a random number between 0 (inclusive) and <nMax> (exclusive).

 Description

     Generates a non-integer random number based on the Linear
     Congruential Method.

     If you need a random number between 1 and <nMax> inclusive, INT()
     the result and add 1.

     If you need a random number between 0 and <nMax> inclusive,
     then you should ROUND() the result.

 Examples

      nResult := INT( FT_RAND1(100) ) + 1    // 1 <= nResult <= 100
      nResult := ROUND( FT_RAND1(100), 0 )   // 0 <= nResult <= 100
      nResult := FT_RAND1( 1 )               // 0 <= nResult < 1

 Source: RAND1.PRG

 Author: Gary Baren

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