Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reliability of RAND() function
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00386726
Message ID:
00386995
Views:
11
>>Is anyone aware of reliability checks of FoxPro's RAND() function to determine whether it adequately
>>simulates random numbers on the interval (0,1)? Thanks.
>
>Superficially, it looks pretty decent. I ran the code below and got the following results for 1M iterations:

>0.0 < 0.1 99,986
>0.1 < 0.2 100,275
>0.2 < 0.3 100,187
>0.3 < 0.4 99,832
>0.4 < 0.5 100,005
>0.5 < 0.6 100,122
>0.6 < 0.7 100,162
>0.7 < 0.8 99,847
>0.8 < 0.9 99,815
>0.9 <= 1.0 99,769

Yes, RAND() is good. I did some tests using SAS a couple years ago, and vfp RAND() came up a statistically very random Uniform distribution. I use it in statistical work without concern here.

Meanwhile, ironically SAS failed miserably with its equivalent Uniform random generator (and it's a statistical app). Pascal also had a bogus one, it would give the same second number each time after a restart, something like that :)

We have a professional procedeure developed by a bunch of statisticians here using prime numbers to generate random uniforms from mainframe days, but the vfp RAND() is probably just as good as that.
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Previous
Reply
Map
View

Click here to load this message in the networking platform