in reply to why the array index has to start at 0??
with mod operator, for ring buffers:
$buffer[$i++ % $SIZE] = $foo; [download]
$pick = $array[rand(@array)]; [download]
ZeroFoo