Skip to content

Biased shuffling #3

@ARR4N

Description

@ARR4N

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions