It seems we have a new winner with Roquen’s POT Permutaed Sequence implementation in the speed category
On my rig with 100 iterations with a collection size of 2^20 the time taken (in milliseconds:)
Prime Step time taken = 1755
Bucket Riven time taken = 10351
Power of Two Perturbed Sequence by Roquen time taken = 393
Directional by UprightPath time taken = 974
even in the worst case scenario (collection size of 2^20 + 1 ) the POT method still wins:
Prime Step time taken = 1751
Bucket Riven time taken = 10196
Power of Two Perturbed Sequence by Roquen time taken = 1228
Directional by UprightPath time taken = 977
Directional implementation is now the speediest! in this worst case for POT.
Code for the testing can be found at: http://www.java-gaming.org/?action=pastebin&id=125
@UprightPath: thanks for the definitions Unfortunately I think I might have stuffed up integrating your code (i get infinite recursion) … Can you have a look over my extensions to see what i did incorrectly? My main changes was always use the collection size /2 as the step. in cases where the collection size is not even, i assume that the collection size is +1 and perform a check to see whether the next “random” index is >= the collection size, if so then ignore it and get the next “random” index. The range is always the size of the Collection (or +1 if odd). The code is included in the above link.
Edit: Updated table to include Directional by UprightPath times