Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random generation
Message
De
13/05/2005 07:52:14
 
 
À
13/05/2005 07:18:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01013774
Message ID:
01013789
Vues:
12
I've tested out the following:
For I = 1 to 150
  lnQuesKey = CEILING( INT( RAND() * 2500) )
* Fetch the question rec with lnQuesKey as PK
Endfor
Can't guarantee that it will give every no. from 1 to 2500 (without testing it an infinite no. of times!!!) but it seems to suffice, and HAS returned 1, and nos 1-10.

HTH

Terry

PS I set "Set Decimals" to 5, so can have very small root no. to randomise, i.e. 0.0001


>hi all,
>
>i am expected to generate a question paper consisting of 150 questions from a database of 2500 questions. Further, I am supposed to generate the question paper each time someone is required to take a test by RANDOM selection of questions from the above database.
>
>Can someone please enlighten me as to how i can go about RANDOMLY selecting 150 questions each time as i do not have the slightest idea as to how to go about this task ?
>
>With sincere thanks.
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform