Detect for time horizon.
Use rand() is better than rand(targetNum)