On (22 Apr 98) David Williams wrote to Peter Dalton...
Hi David,
DW> But does it matter? In the next few lines of the program, I filled the
DW> array with numbers.
yes and I'd have done the same except to fill the array with 0's.
-> DW> 200 ' shuffle random 6 numbers into first 6 positions
-> um, what for?
DW> um, because the program is simulating a lottery, which picks six random
DW> numbers.
erm, sorry I didn't explain it too well...why shuffle the numbers into
the first six position?
-> IF A%(Y%) 0 then 220
-> A%(Y%)=1 NEXT
DW> Nope. Frankly, I haven't a clue what you think this will achieve.
the array (A%) holds zeros to start with. Generate a random number (Y%)
between 1 and 49 and check to see if that array element holds a zero. If
it does then poke a '1' in there, if it doesn't then find another random
number.
After six numbers you read the array from 1 to 49 and when you find an
element with '1' in it then you note the element number as that's one of
your random set.
DW> Did you try running the program, as I wrote it? It does work. Did you
DW> then try modifying it? Did it still work?
no I didn't try running it as I assumed that it worked when you posted
it. I didn't try running mine either as I've used it many years ago and
know that it works, though as it wasn't a complete sub-routine it would
be up to who-ever wanted to use it to add the fiddly-bits...
Success
Peter
--- PPoint 1.88
---------------
* Origin: Peter Points at last! (2:254/60.26)
|