# How do I generate random nfts from a set amount of different characteristics? Like bored bananas, wicked craniums

**URL:** <https://forum.openzeppelin.com/t/how-do-i-generate-random-nfts-from-a-set-amount-of-different-characteristics-like-bored-bananas-wicked-craniums/14416>\
**Category:** Smart Contracts\
**Created:** [August 23, 2021, 5:30pm UTC](https://forum.openzeppelin.com/t/how-do-i-generate-random-nfts-from-a-set-amount-of-different-characteristics-like-bored-bananas-wicked-craniums/14416 "2021-08-23T17:30:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [October 6, 2021, 10:11pm UTC](https://forum.openzeppelin.com/t/how-do-i-generate-random-nfts-from-a-set-amount-of-different-characteristics-like-bored-bananas-wicked-craniums/14416/2 "2021-10-06T22:11:25Z")

</div>

Generally all of the images are generated beforehand and later distributed. It is a challenge how to distribute them randomly in a way that is not easy to game. More discussion here:

> [@Are NFT projects doing starting index randomization and provenance wrong or is it just me?](https://forum.openzeppelin.com/t/are-nft-projects-doing-starting-index-randomization-and-provenance-wrong-or-is-it-just-me/14147):
>
> Hi, There is a pattern in many PFP projects where the tokenURI does something like: function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(\_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = \_baseURI(); return bytes(baseURI).length \> 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } Where the baseURI is some IPFS directory. This is the standard implementation from Ope…

---

_[View the full topic](https://forum.openzeppelin.com/t/how-do-i-generate-random-nfts-from-a-set-amount-of-different-characteristics-like-bored-bananas-wicked-craniums/14416)._
