It does that when get_players() finds no players, resulting in a random( 0 ) call which will return a number outside the boundaries of your array, and is irrelevant for what you're doing.
Do this:
PHP Code:
if ( num > 0 )
Boss1 = players[ random( num ) ];
__________________