Random selection

Lurking. said:
Yes I may have to go back to Basic, GWBasic is still on the the 98SE machine, but it's using a 16in LCD screen that got clobbered by the 6.3 earthquake in Feb. There is a 4inch square that is unreadable in the bottom r/h corner.
Have not waited for the EQC or Insurance to replace, so have put what I think the people will reimburse onto this XP machine, a 18.5 lcd wide screen.
Denis, thanks for your efforts and a file would be much appreciated.
First, I fail to see what screen size has to do with all this!
Start by downloading GWBasic; this looks like a good site to do it from:
http://www.oocities.org/KindlyRat/GWBASIC.html

Sending you "a file" is too complicated for something as simple as this;
simply code the following (remember that GWBasic uses line numbers);
I'll use the example I typed out for you earlier (5 numbers);
Basic commands shown in capitals, variables in lower case:

100 RANDOMIZE
110 DATA 2,3,5,7,8
120 n = 5
130 DIM a(n), b(n)
140 FOR x = 1 TO n : READ b(n) : NEXT n
150 r = n
160 FOR x = 1 TO 5
170 p = INT(RND * r) + 1
180 a(x) = b(p)
190 b(p) = b(r)
200 r = r - 1
210 NEXT x

NOTES:
lines 110,120: important that n equals number of numbers in DATA line

130: sets up 2 arrays; array a to record the random job, array b to receive the numbers from DATA line

140: numbers from DATA line entered in array b

150: variable r becomes the "numbers left" recorder, and is used in the random process as it decreases

170: picks at random a number from 1 to r

180,190: updates the arrays

200: this is where the numbers left is updated

Good luck...you owe me a dozen kiwis :wink:
 
Dennis, thanks for your reply.


First, I fail to see what screen size has to do with all this!
Start by downloading GWBasic; this looks like a good site to do it from:
http://www.oocities.org/KindlyRat/GWBASIC.html


Not the screen size, but the damage to the screen as mentioned "clobbered" was the relevant word, see attached.

Had tried to make the cursor black, but the scope is outside the machine and on the screen itself.

GWBasic already on the 98SE too.

Will see how I go with you listing.

Denis thanks again for your time and effort.

Kind regards,

Lurking.
 

Attachments

  • 16 inch screen !!!.jpg
    16 inch screen !!!.jpg
    9.3 KB · Views: 85
Hi Denis, you only get the Kiwis if the system works.

I love MS-Dos QBasic under Win98SE as it does the editing for one, spacing and all that sort of thing, only thing is their help file is missing !.

Line 140 edit states " NEXT without FOR"

At this stage I have only tested your little file as is where is.

Regards,

Lurking.
 
Lurking. said:
Line 140 edit states " NEXT without FOR"
Line 140 I gave you:
140 FOR x = 1 TO n : READ b(n) : NEXT n

Should be:
140 FOR x = 1 TO n : READ b(x) : NEXT x
(1st mistake this year!)

1000 apologies of which you may have 1 :wink:
 
Denis, here is your Kiwi.

Regards,

Lurking.[attachment=0:23qco6yn]Kiwi.JPG[/attachment:23qco6yn]
 

Attachments

  • Kiwi.JPG
    Kiwi.JPG
    5.4 KB · Views: 75
tkhunny said:
I see. You need selection without replacement. You may have to do some sorting. It would not be TOO hard to write a little VBasic routine.

You could try this...http://www.youtube.com/watch?v=SoK9kq-0uXg

Hi tkhunny, have watched the video a few times, pausing as we go and have gotten to the last Match up sequence but seem to be lost on the formula her.

Boy, these arrays/ranges/tables sure have my old brain working overtime these days!.

See attached file, this is in Excel 2000.

Once the thing works we will be able to hide a couple of columns as stated in the video.

Regards,

Lurking.
 

Attachments

  • Opawa Church No. 2.jpg
    Opawa Church No. 2.jpg
    73.7 KB · Views: 69
Top