Randomised quick sort

I am unable to understand why prateek bhaiya took mod of i+1 with the rand function rather he should have taken i-1 because here we are trying to generate an index below i to swap the numbers.

hey @ashish_meher, go through the video once again, Prateek Bhaiya has explained the use of i+1 at 15.25.

hey @ashish_meher , if no further query,please mark this doubt as resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.