According to the rA documentation -
*rand(<number>{,<number>});
This function returns a number ...
(if you specify one) ... randomly positioned between 0 and the number you specify -1.
(if you specify two) ... randomly positioned between the two numbers you specify.
rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
rand(2,5) would result in 2,3,4 or 5
in your case, the rand can range 0~4 (6047 ~ 6051) where homunculus 6047 doesn't exist.