Denis,
your delay, is this like
thisform.nTot = 75
RAND(-1)
DO WHILE thisform.nTot > 0
nIdRandom = INT(thisform.nTot * RAND() + 1)
.
.
.
thisform.nTot = thisform.nTot - 1
WAIT TIMEOUT 8
ENDDO
or like
DO WHILE .t.
thisform.nTot = 75
RAND(-1)
DO WHILE thisform.nTot > 0
nIdRandom = INT(thisform.nTot * RAND() + 1)
.
.
.
thisform.nTot = thisform.nTot - 1
ENDDO
WAIT TIMEOUT 8
ENDDO
?
Since the seed of -1 does something with the system timer, this might be in the logic of this. Use the seed only one time, initialy.
Lutz
>
>thisform.nTot = 75
>RAND(-1)
>DO WHILE thisform.nTot > 0
> nIdRandom = INT(thisform.nTot * RAND() + 1)
> .
> .
> .
> thisform.nTot = thisform.nTot - 1
>ENDDO
>
>
>I didn't show all the code because I created a cursor that will contain random numbers that were generated.
>
>So mainly this is how I do it now, but my weird results were obtained on a timer executing my random generation. Good results obtained on my timer being called every 6 seconds. Not so random numbers each 8 seconds.
>
>
>
>
>>>Hello all,
>>>
>>>I need to generate random numbers. I need to get all numbers from 1 to 75 but randomly. I generated those but with a delay. Everything looked good when I generated those numbers with a delay of around 6 seconds. This means that numbers looked realy random. For example numbers generated looked like 25, 47, 12, 59 and so on.
>>>
>>>A delay of six seconds between generated numbers was not enough. I had to increase the delay to 8 seconds. That's when the weirdest thing happened. The generated numbers didn't really look random. For example generated numbers looked like 23, 34, 45,46,47,48,49,50, 51, 30,31,32,33,34,45.
>>>
>>>So I assume that the delay is the problem.
>>>
>>>My solution to that weird problem. I generate all the random numbers without a delay between each generated number.
>>>Then I get all the numbers in the order they were generated each 8 seconds.
>>>
>>>Can anybody explain me why there seems to be a problem with random numbers and a delay?
>>>
>>>Regards
>>
>>Hi Denis
>>
>>I've run
>>
>>FOR i= 1 TO 10
>>?RAND()*75
>>WAIT TIMEOUT 8
>>endfor
>>
>>and the result looks random enough. What is the code you use the RAND? Is there a seed? What is happening in the time between?
>>
>>Lutz
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]