Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Random numbers - the most efficient way
Message
 
 
To
07/09/2004 10:21:51
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00939849
Message ID:
00940177
Views:
27
>>Mohammed Qasem gave me a quite interesting problem, which I am now (12:13am) trying to solve the most elegant way.
>>
>>Here is a problem:
>>
>>We have a small set of records. We need to extract randomly smaller subset of records. Say, we have 300 records, we would need to randomly choose 40 records out of this set. Number of records to remove is always less than the number of records in a set.
>
>The way I used to do this before "select top n" was available, was to use an array with record numbers, select one element at random, remove it from array (using adel() and redimensioning the array).

Today in the morning before I read Al's and Sergey's replies I came up to this idea as well (though through cursors' implementation).
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform