CT_RAND

 RAND()
 Generates random numbers
------------------------------------------------------------------------------
 Syntax

     RAND([<nStartValue>]) --> nRandomValue

 Argument

     <nStartValue>  Designates a beginning value for the random number
     generator.

 Returns

     RAND() returns a random number between 0 and 1.

 Description

     In contrast to RANDOM(), this function works with a seed algorithm.
     Multiple calls always returns the same random number sequence when it
     has the same start value.  When you first call RANDOM() without a
     parameter, it starts as if 100001 is specified as a parameter.
     Subsequent random numbers can then be influenced by the < nStartValue>.
     If this value is less than or equal to 0, the clock time is brought into
     the process.

     If you call the function with 100001 as a parameter, it allows you to
     restart the generator.  Then, if you call the function several times
     without parameter, it returns the "standard sequence" of numbers.

 Examples

     .  Call after program start:

        ? STR(RAND(), 18, 15)            // 0.831051100158447
        ? STR(RAND(), 18, 15)            // 0.557946857971956

     .  If the parameter equals 0, the clock time is incorporated.
        Even if the clock has not yet advanced, subsequent values are still
        different:

        ? STR(RAND(), 18, 15)            // Time dependent
        ? STR(RAND(), 18, 15)            // Subsequent time
                                         // dependent value

     .  Use a number greater than 0:

        ? STR(RAND(23), 18, 15)          // 0.121169930053736
        ? STR(RAND(23), 18, 15)          // 0.121169930053736

     .  Show a "new start":

        ? STR(RAND(100001), 18, 15)      // 0.831051100158447
        ? STR(RAND(), 18, 15)            // 0.557946857971956

See Also: RANDOM()

 

Tools – Numbers/Bit Manipulation

Introduction
BITTOC()     Converts position-dependent bits into characters
CELSIUS()    Converts a Fahrenheit temperature value into Celsius
CLEARBIT()   Clears one or more bits within a number to zero
CTOBIT()     Converts a character string into a bit pattern
CTOF()       Converts a special 8-byte string into a floating point number
CTON()       Converts a numeric string into a different base
EXPONENT()   Determines the exponent of a floating point number (base 2)
FAHRENHEIT() Converts a temperature value from Celsius into Fahrenheit
FTOC()       Converts a floating point number into a special 8-byte string
INFINITY()   Creates the largest number possible (21023)
INTNEG()     Converts an unsigned integer into a signed integer
INTPOS()     Converts a signed integer into an unsigned integer
ISBIT()      Tests the bits in a number
LTON()       Converts a logical value into a numeric value
MANTISSA()   Determines the mantissa of a floating point number (base2)
NTOC()       Converts numbers in a digit string into a different number base
NUMAND()     Performs a 16-bit "AND" of a list of numbers
NUMCOUNT()   Uses the internal CA-Clipper Tools counter
NUMHIGH()    Returns the higher value byte in a 16-bit number
NUMLOW()     Returns the lower value byte in a 16-bit number
NUMMIRR()    Mirrors 8-bit or 16-bit values
NUMNOT()     Performs a 16-bit "NOT" of a number
NUMOR()      Performs a 16-bit "OR" of a list of numbers
NUMROL()     Performs a 16-bit left rotation of a number
NUMXOR()     Performs a 16-bit "XOR" of two numbers
RAND()       Generates random numbers
RANDOM()     Generates random numbers
SETBIT()     Sets one or more bits in a number