Randomised quick sort

why dont we just swap any two numbers instead of using whole srand and rand function…
any difference in the two ??

The more you randomize an array, the better you will improve its worst time complexity. You must know that for already sorted array the worst time complexity is O(n^2). Now even you you swap just 2 numbers, the majority part of the array will still be sorted.