Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Random numbers - the most efficient way
Message
From
09/09/2004 01:26:28
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00939849
Message ID:
00940492
Views:
22
Hmm... my cellphone call example may not be a good illustration of the idea; you could well get only people who call around midnight, and none around noon. Clearly you have to remove any record-to-record dependencies.

But, suppose you have a cursor with a million random integer values, not related to each other. If you want 40 random values, taking 40 sequential records is just as good as taking 40 at random.

Forgive me btw if I'll take "going back to school" under advisement ;-)

>Al,
>
>Sorry but you need to go back to school and study random sampling theory. You have imposed a time of acquisition dependency on your sample.
>
>A uniform random sample must give every record the same probability of being selected. With what you propose only the first record meets this condition.
>
>>This may be beating the topic to death - but here's another idea, anyways:
>>
>>If your data are truly random, then to get 40 random values, all you need to do is pick a random start point, then select the next 40 records! Those 40 records will be as random as any 40 you could pick "randomly". (You'd have to handle the case where your start point was near the end of the file by wrapping back around to the beginning).
>>
>>Suppose, for example, you're a telco and you're tracking the starting datetime of cell phone calls placed in Manhattan. If you want to hand out prizes to 40 random subscribers, picking a start datetime and selecting the next 40 records will likely be just as random as picking 40 random datetimes. In both cases you'd have to prevent duplicates, of course.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform