Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A little confused with RAND()
Message
De
01/04/2009 10:11:01
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01392453
Message ID:
01392573
Vues:
49
>>>Hi,
>>>
>>>Here is an example and the results with question inline:
>>>
>>>
>>>SET DECIMALS TO 6
>>>ldBaseDate = {^1900-01-01}
>>>ldCurrDate = DATE()
>>>RAND(ldCurrDate - ldBaseDate)
>>
>>I see you've solved your original problem. I'm just wondering why you're seeing RAND() this way. Is there some
>reason RAND(-1) won't work for you?
>>
>>Tamar
>
>I use this "RAND(()" approach to generate the same key/code on my computer and the customer computer. The customer does not know that I use this routine and thinks that it is completely random. Once I tell them to enter the returned "code/key" the program verifies it (using the same code I use on my PC) and can perform a procedure that should only be performed under "my supervision." I hope my explanation is clear.

A year ago I would have told you this could be broken by the next version of Fox... if it decides to change the randomizer's algorithm. You should be safe from that kind of surprise now... unless, in the background, rand() is just a wrapper around some API call, which may change at random (don't hang the pun, pardon it) with any version or SP of Windowses. Which we don't know... so I'd rather have a sys(2007) of something based on the dates - it would still look random, but wouldn't be.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform