Suppose I have 1000 NFT's I would like to distribute. The user can see what any NFT looks like in advance, but they don't know what they'll be getting until they actually buy it. In other words, there will be a random number generated from Chainlink VRF that determines what they get. This ensures a fair distribution, so the rare NFT's can't be bought by early users.
The project that I see comes closest to this is Hashmasks, but they also had the quality that the user didn't even know what any of the artwork would look like in advance. For the purposes of my project, I don't need this property.
The main issue I see with Hashmasks is that there is no tokenURI function. They upload everything on IPFS, so it seems the only way to have a tokenURI would be to know the hashes of every NFT in advance and store them in the contract, and then append it to the IPFS url prefix, but this would be incredibly expensive.
I was wondering if there was a way I could still retain the property of having the tokenURI whilst also ensuring a random distribution.
For the random distribution part, I was thinking of getting a random number, r, from chainlink VRF, and then doing:
i = rand % maxSupply
Then I check ownerOf(i), if it's taken, then i+=1, if not taken, then assign. I was wondering, does the mere checking of ownerOf(i) take gas fees? This loop, in the worst case scenario, would take maxSupply - 1 iterations to assign a NFT; how bad could the gas fees look like?