fix random(1,6000) may return -ve result

fix random(1,6000) may return a negative number on iOS