Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RAND() not very random
Message
 
 
To
26/09/2006 14:38:59
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01155607
Message ID:
01157350
Views:
33
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
Previous
Reply
Map
View

Click here to load this message in the networking platform