Thanks for the response. I think I sort follow what you are saying. what if I changed the code below to regenerate the total if it equals the lower? It seems like a bit of a hack but I just did a quick test and it seems to work without the freeze up.
gnLower = 10
gnUpper = 99
total=gnLower
do while total=gnLower
total = INT((gnUpper - gnLower + 1) * RAND() + gnLower)
enddo
num1=total
do while num1=total
num1 = INT((total - gnLower + 1) * RAND() + gnLower)
num2 = total - num1
if num1=num2
num1=total
endif
enddo
Hi Darrell,
The problem is that as soon as total = gnLower the num1 value is not changing. No matter what is rand():
INT(rand()+ whole_number)= whole_number
>I'm having some issues with the code below where that causes my app to freeze up. This code is in a scan..endscan where I create the 2 numbers below and then update values in a table. The code does not freeze up consistently but I can duplicate it if I run it enough but there is no particular pattern to the problem. any ideas?
>
>
>
> gnLower = 10
> gnUpper = 99
>
> total = INT((gnUpper - gnLower + 1) * RAND() + gnLower)
> num1=total
> do while num1=total
> num1 = INT((total - gnLower + 1) * RAND() + gnLower)
> num2 = total - num1
> if num1=num2
> num1=total
> endif
> enddo
>