Information générale
Catégorie:
Codage, syntaxe et commandes
Hi Quinn,
Several years ago I worked on a random generator for Boise Cascade out here in Idaho. For the forest service we needed a true random selector for scale loads coming into the mills.
What you are doing is on the right track. Here's a portion of our code:
select file
replace all fedit with 0
=rand(-1) && To achieve the most random sequence of numbers, issue
&& RAND( ) initially with a negative argument and then
&& issue RAND( ) without an argument.
tcnt = 0
do while .t.
mchoose = int(reccount() * rand())
if between(mchoose,0,reccount()-1)
go top
skip mchoose
replace fedit with 1
tcnt = tcnt + 1
endif
if tcnt > reccount() * .2
exit
endif
enddo
You now have 20% of your records ramdomly selected.
Hope this helps
Bruce
-------------------------------------------------
There is no nobility in being superior to
anyone else; nobility is derived from being
superior to that which you were yesterday
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement