Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Random
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Re: Random
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01122269
Message ID:
01122290
Views:
22
This message has been marked as the solution to the initial question of the thread.
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
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform