javiz Posted June 10, 2007 Report Share Posted June 10, 2007 Kā realizēt to , lai testā iespējamie atbilzu varianti katru reizi manītu secību? (atbildēm tiek izmantotas radiopogas) Link to comment Share on other sites More sharing options...
Neps Posted June 10, 2007 Report Share Posted June 10, 2007 Kā realizēt to , lai testā iespējamie atbilzu varianti katru reizi manītu secību? (atbildēm tiek izmantotas radiopogas) 1. tev saakumaa nodefineets ir atbilzhu variantu seciiba masiivaa $variants array( a: ABCD b: BACD c: CABD d: DABC e: utt ) 2. katru reizi, kad jaaparaadaas atbildeem , uztaisi $r=rand(atbilzhu variantu iespeejas); 3. izdrukaa attieciigo variantu variants[$r]; nav programmisiki pareizi bet ideja saprotama Link to comment Share on other sites More sharing options...
Exzo Posted June 10, 2007 Report Share Posted June 10, 2007 Labāk lietot shuffle(), jo ar rand() atbilžu varianti var atkārtoties. Tīri teorētiski visi var būt pat vienādi. Link to comment Share on other sites More sharing options...
Kavacky Posted June 10, 2007 Report Share Posted June 10, 2007 array_rand() arī der. Link to comment Share on other sites More sharing options...
andrisp Posted June 10, 2007 Report Share Posted June 10, 2007 Vai arī, ja tiek izmantota db, tad ORDER BY RAND() (mysql). Link to comment Share on other sites More sharing options...
Recommended Posts