break on
Dim $Array[0] ; Must initialize the array first!
SRND(@msec)
$Pick = 2 ; 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 = ReadLine(1)
Loop
$ = Close(1) ; closed the file
EndIf
$Size = Ubound($Array)
$Size + 1 ' elements were loaded' ? ; show element count
$SizeTotal = $Size + 1
$SizeTotal ?
If $SizeTotal =< $Pick
"Entries in file less than or equal to $PICK" ?
Sleep 3
Exit
EndIf
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
Sleep 3