Olá!
Augusto escreveu:Já tentei com RAND() e RANDOM() e continua o mesmo erro.
Estou com as bibliotecas CT.LIB e CTP.LIB dentro da pasta \CLIP53\LIB usando
Se realmente está linkando a CT.LIB, não teria como dar erro. Na CT.LIB, não existe a função RND(). Existem as funções
Rand() e
Random(), conforme consta no
CA Clipper Tools - Books 1 - 3 Norton Guide 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()
RANDOM()
Generates random numbers
------------------------------------------------------------------------------
Syntax
RANDOM([<lMode>]) --> nRandomWORD
Argument
<lMode> Designates whether or not to return negative numbers. The
default creates only positive numbers.
Returns
RANDOM() returns a random number in the range of 0 to 65535 or when
<lMode> is designated as .T., in the range of -32768 to +32767.
Description
RANDOM() produces random numbers to create a random distribution of test
data for DEMO programs or any other application.
Note
. If the <lMode> parameter is not specified, only positive
numbers are returned. When < lMode> is set to .T., the function
returns the same number of positive and negative numbers.
Examples
. Create a random number between 0 and 65535:
? RANDOM()
. Create a random number between 0 and 1:
? RANDOM()/65535
. Create a random whole number between 1 and 16:
? RANDOM()%16 +1
. Create a random number between -32768 and +32767:
? RANDOM(.T.)
See Also: RAND()