Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rand()
Message
 
 
À
19/11/2009 09:34:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Rand()
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Divers
Thread ID:
01435565
Message ID:
01435621
Vues:
73
>>>RAND() Returns a random number between 0 and 1.
>>>Does that mean if I create a file with a name based on RAND() value I can create 100 files only?
>>
>>You can create any number of files based on RAND() but RAND() returns random number not unique number. IOW it can return duplicate numbers.
>Not sure I understand. I see that rand() returns values based on 1/100. Which means 100 different values. Am I wrong?

Yes you're. The RAND() returns random Double floating point numbers between 0 and 1. It does not guaranty to return unique number though. IOW, it can return the same value more than ones. If you want unique file names for a session, use SYS(2015) or simply increment a number from 1 up.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform