General information
Category:
Coding, syntax & commands
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
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only