What about
SELECT TOP lnNumberToExtract *, RECNO() AS rn, ROUND(RAND()*10000000000,0) AS ord ;
FROM mytable ;
ORDER BY ord ;
INTO CURSOR crsRand
>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.
>
>My first idea:
<snip>
>
>That's what I just write from the top of my head. However, I do not think, it's the most efficient algorithm. Who has better ideas?
>
--sb--