Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Re: Random
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01122269
Message ID:
01122290
Vues:
16
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
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform