But note: The larger the array, the more the branch will hurt you. On average the number of times you will get to break out before the swap when shuffling n elements is log(n)+O(1).
So while it is a loss for an array with 100,000 elements, that is a worst case for having the branch.
In reply to RE (tilly) 1: Fisher-Yates Shuffle
by tilly
in thread Fisher-Yates Shuffle
by Adam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |