Repository navigation
Closes #4787: Shuffling alternative - #4789
Conversation
4d69997 to
29c663a
Compare
|
I like this (mandatory disclaimer: I didn't reverse all of the code, although it definitely looks Feistel-y). I added this to the random_test, just for fun: The shuffled version of an arange should almost never exactly match the original. The sorted shuffled version of an arange should always match the original. In 2000 tries, both of these checks always passed. So I'm inclined to agree that this works. As I write this, it's still in Draft, but if it weren't, I'd approve it. |
29c663a to
bfd78ae
Compare
|
I've realized that my comm diagnostics are not great: I don't think the number of gets should be that high (this was an an array of size 40,000). This is probably affecting performance. For reference, here is the comm diagnostics for MergeShuffle, same array: |
|
I think I fixed the problem. Now the benchmark on 8 locales with an array size of 8,000,000 comes out like this: Furthermore, the comm diagnostics for MergeShuffle all came out along the lines of this: For Feistel, it was Exciting! |
d57814b to
9cc4672
Compare
9cc4672 to
3bace64
Compare
drculhane
left a comment
There was a problem hiding this comment.
I ran the same check as when this was still in draft, and it still passes. Nice work.
This uses the idea of the Feistel cipher to shuffle an array.
Perhaps it should be noted that it won't work on arrays with more than 2^64 elements, but it probably wouldn't take that much effort to extend.
It's possible this could be improved by allowing for imbalanced Feistel ciphers.
Closes #4787: Shuffling alternative