Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RAND() not very random
Message
 
 
À
26/09/2006 14:38:59
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:
01157350
Vues:
34
Ken,

While that's a very interesting tidbit, it really just shows how a pseudo-random number works. Given a particular seed value it will return the exact same sequence of numbers every time. Believe it or not this is a good thing for some applications of random numbers.

>An interisting tidbit from http://fox.wikis.com/wc.dll?Wiki~HelloWorld~VFP
>demonstrates how random it is.
>
>? CHR(INT(RAND(37769.1)*26+65))+;
> CHR(INT(RAND()*26+65))+;
> CHR(INT(RAND()*26+65))+;
> CHR(INT(RAND()*26+65))+;
> CHR(INT(RAND()*26+65))+;
> " "+ ;
> CHR(INT(RAND(1612256)*26+65))+ ;
> CHR(INT(RAND()*26+65))+ ;
> CHR(INT(RAND()*26+65))+ ;
> CHR(INT(RAND()*26+65))+ ;
> CHR(INT(RAND()*26+65))
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform