removed useless evaluation ($right - $left <= 1) and changed random range to 1000