This one works - the corrections and enhancements are commented. Note that there is nothing preventing the same data from being displayed more than once - if duplicate selections is a problem, you can modify the code slightly to select an array element pointer. If the element contains data, you output it and clear the element. If the element is empty, it's been used, so reduce the counter by one instead of outputting the value.
 Code:
break on

Dim $Array[0]				; Must initialize the array first!

srnd(@msec)
$Pick = 4 ; how many do you want

$Counter = -1				; alternate, pre-increment method uses -1 init

If Open(1,"c:\data\file.txt") = 0	; trapped the result code
  $Line = Readline(1)
  While @error = 0
    $Counter = $Counter + 1		; moved to pre-increment
    redim preserve $Array[$Counter]
    $Array[$Counter] = $Line
    $Line ?
    $Line = Readline(1)
  Loop
  $ = Close(1)				; closed the file
EndIf

$Size = Ubound($Array)
$Size + 1 ' elements were loaded' ?	; show element count

For $Output = 1 to $Pick		; counter, not array index, so 1-based
  $Array[RND($size)] ?			; corrected d"(" and "[" 
Next

If you simply add the element count to the original code, you always get 0 (-1 ubound). That's because the array was not declared before being ReDim'd. This resulted in no data in the array.

I modified the loop to a pre-increment model (personal preference). Both work, but in pre-increment, the array index pointer always accurately reflects the array count, which could eliminate the need for the UBound in certain code applications.

I added an If to the Open to trap the result code, preventing the extraneous zero from appearing on the console, as well as added the Close call.

The Element Count message pointed to the original problem of an uninitialized array.

Finally, the parens and square braces were messed up again. I also changed the For loop to be 1-based. This is why you were getting an extra item. The $Output value is a counter of the number of selections, so should be 1-based. The Rnd function returns a value between 0 and the max value (array size) and is the array element index, which is properly zero-based.

Here's an alternate loop to prevent duplicate selections:
 Code:
For $Output = 1 to $Pick
  $Index = RND($size)            ; select a random element
  If $Array[$Index]              ; does it contain data?
    $Array[$Index] ?             ; then display it
    $Array[$Index] = ''          ; and clear it to prevent re-use
  Else
    $Output = $Output - 1        ; reduce the output count so we try again
  EndIf
Next

This assumes you don't need the array data. If you need to maintain the array data, you can duplicate the array and use the duplicate for controlling the output.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D