Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rand()
Message
 
 
To
19/11/2009 09:34:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Rand()
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Miscellaneous
Thread ID:
01435565
Message ID:
01435621
Views:
72
>>>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--
Previous
Reply
Map
View

Click here to load this message in the networking platform