Demonstrate how to pick a random element from a list.




'setup
DIM foo(10) AS LONG
DIM n AS LONG, x AS LONG
FOR n = LBOUND(foo) TO UBOUND(foo)
    foo(n) = INT(RND*99999)
NEXT
RANDOMIZE TIMER
 
'random selection
x = INT(RND * ((UBOUND(foo) - LBOUND(foo)) + 1))
 
'output
PRINT x, foo(x)