Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RAND() not very random
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01155607
Message ID:
01207261
Vues:
27
>>Here's a funny one. No biggie but a bit annoying.
>>
>>I use the following code to generate a fairly unique filename for my exported XLS file, incorporating today's date + a random no. suffix, in case several XLSs are generated in one session/day, so they don't need to keep typing in a new name. This has been working fine till today. But today it keeps giving 851 and 856 (and others similar) off my m/c AND the 2 users' m/cs, such that my code, and Excel's interface keep asking if want overwrite.
>>
>>
>>lcRandNum	  = ALLTRIM( STR( INT( RAND() * 1000)))
>>lcDateStr	  = ALLTRIM( DTOC( DATE()))
>>lcDateStr	  = STRTRAN( lcDateStr, "-", "_") + lcRandNum
>>lcFilePath = PUTFILE("Export Results", "S" + lcDateStr, "XLS")
>>
>>
>>Both when testing and today I've been issuing:
>>
>>? STR( INT( RAND() * 1000))
>>
>>repeatedly at the command line with expected varied results. Any ideas?
>>
>>'ppreciate it
>>
>>Terry
>
>I have an idea and it was recently discussed, but I'm not telling to a person not knowing how to use Help <g>

This definitely was offensive.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform