Assume I have a selection of token IDs, for instance:
uint256[] public tokenIds = [1,2,3,4,5];
Now, incorporate a random number generated by Chainlink, let's say:
uint256 public randomNumber = 98346139420554933047845823368198375528330957585398133092102047626198817698038;
At the moment, the approach I am taking is basically to take this large random number and:
uint256 public randomOffset = randomNumber % tokenIds.length;
This gives me a random offset, so if for example, randomOffset ends up being 1, then if a person wants to claim their token, for claiming token 1, they would instead get token 2, claiming token 5, they would instead get token 1 (wraps around).
So this gives me some ability to enable randomised claims of tokens, however, here is the problem:
The offset means that if someone can claim 5 tokens, they will all be sequential (sure, they will be offset by a random amount, but they would still get 5 consecutive token IDs).
I was wondering, is there a way for me to use the random number to have a uniform distribution of randomness?
So for example there isn't this consecutive number issue, instead each token ID will actually correspond to a more random distribution, where for example:
token ID 1 -> 2
token ID 2 -> 4
token ID 3 -> 5
token ID 4 -> 3
token ID 5 -> 1
This video at this timestamp basically shows exactly what I am trying to do in my use case:
https://youtu.be/YEBfamv-_do?t=307
Does anyone know how I could achieve this? Or would it need to be a situation where I have a prime number and a "primitive root" of that prime number as the video shows? Is there a totally different method I could use? I'm not good with mathematics so I apologise if I am being silly.