Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random numbers - the most efficient way
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00939849
Message ID:
00939910
Vues:
17
This message has been marked as a message which has helped to the initial question of the thread.
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform