-> DW> 130 DIM A%(49)
-> doesn't this set all elements of the array to zero?
....
-> IF A%(Y%) 0 then 220
etc...
Ah! It took 24 hours for the significance of your remarks to sink in,
but I think I now understand what you were saying.
You think the program uses the array as a set of flags, to tell when a
number has already been chosen. If it were used that way, it would
initially be filled with zeroes, and each element would be set to 1 (or
something) when the corresponding number is chosen. If a number is
picked whose flag is already non-zero, the program would go back and
pick another one.
But this is precisely the kind of inefficient coding that I was intent
on avoiding! As I said previously, it is virtually *never* necessary to
do that kind of repeated RND-generation (which could, by chance, go on
for a long time) until a number is found that fits some criterion. The
program I posted does *not* do that. The array is *not* a set of flags,
and it is *not* initially filled with zeroes. Instead it is filled with
the numbers from which random ones are to be chosen - the integers 1 to
49, in this case - and is manipulated so as to choose six of them at
random, without any possibility of repetition.
Surely, it should at the very least have been obvious that the array was
not filled with zeroes!
dow
--- PCBoard (R) v15.3 (OS/2) 5
---------------
* Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710)
|