PROC myfirst:
      LOCAL i%,j%  rem Counters used in number selection loop
      GLOBAL numbers%(6) rem Array to store picked numbers

	RANDOMIZE MINUTE + SECOND

     DEFAULTWIN 1  rem Enables use of greyscale on 3a/3c

     setup:

     i%=1
     WHILE i%<=6
        picknum:(i%) rem Pick a unique number for the i%-th ball   
        gSTYLE 41
        gAT 60+(i%-1)*50,130
        gPRINT numbers%(i%)
        i%=i%+1
     ENDWH
     BUSY "Press a key to exit"
     GET
ENDP


PROC picknum:(number%)
rem To choose a unique ball number for position no. number%
LOCAL j%

picknum::
numbers%(number%)=INT(RND*50)+1 rem add 1 to take the number into the 1 to 50 range
j%=1
WHILE j%<=(number%-1)
  IF numbers%(number%)=numbers%(j%)
     GOTO picknum::    rem Duplicate number, so go and try again!
  ENDIF
  j%=j%+1
ENDWH

RETURN
ENDP


PROC setup:
rem Graphics stuff done at the start of the program
gGREY 1
gAT 0,0
gFILL gWIDTH,gHEIGHT,0
gGREY 0
gSTYLE 41 rem Bold, Double height, Italic
gAT 50,40
gPRINT "Milo v0.1 (C) Fred Bloggs 1998"
gSTYLE 33 rem Bold, Italic
gAT 50,65
gPRINT "Here are the numbers for the next lottery:"
gAT 50,80
gFILL 300,70,1
gGREY 1 :gFILL 300,70,1 :gGREY 0
RETURN
ENDP