Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Biased shuffling #3

Open
ARR4N opened this issue Oct 14, 2021 · 0 comments
Open

Biased shuffling #3

ARR4N opened this issue Oct 14, 2021 · 0 comments

Comments

@ARR4N
Copy link

ARR4N commented Oct 14, 2021

This is a great initiative, thanks for starting it.

Your Fisher–Yates implementation biases selection of early entrants by use of modulus (Wiki explanation).

uint256 randomIndex = i + entropy % (raffleEntries.length - i);

I suspect that reuse of the same entropy will introduce other biases, but how the affect the implementation is less immediately obvious. My initial thoughts are that you need to use the entropy from VRF in a construction like keccak256(abi.encode(vrf_entropy, counter)) so that each selection is independent. However this becomes expensive.

FWIW I'm @divergence_art in the NFT world should you want to chat on Twitter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant