MultiRaffle icon indicating copy to clipboard operation
MultiRaffle copied to clipboard

Biased shuffling

Open ARR4N opened this issue 2 years ago • 0 comments

This is a great initiative, thanks for starting it.

Your Fisher–Yates implementation biases selection of early entrants by use of modulus (Wiki explanation). https://github.com/Anish-Agnihotri/MultiRaffle/blob/55c4c4af14ab06f795b564ed42f569ea420e1d4f/src/MultiRaffle.sol#L177

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.

ARR4N avatar Oct 14 '21 13:10 ARR4N