With branch: O(n) - O(log n), still O(n)
No branch: O(n) - O(n) + O(log n), still O(n).
In the long run, branch or no branch, the time is still dominated by n calls to the random function.
In reply to RE: RE (tilly) 3: Fisher-Yates Shuffle
by BlaisePascal
in thread Fisher-Yates Shuffle
by Adam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |