# Random Mint

**URL:** <https://forum.openzeppelin.com/t/random-mint/26875>\
**Category:** Smart Contracts\
**Created:** [March 28, 2022, 1:35am UTC](https://forum.openzeppelin.com/t/random-mint/26875 "2022-03-28T01:35:12Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [April 8, 2022, 8:35pm UTC](https://forum.openzeppelin.com/t/random-mint/26875/5 "2022-04-08T20:35:11Z")

</div>

Randomness in smart contracts is difficult to achieve. There is a lot written about this, even in this forum. Please search the forum and the web for "NFT randomization" or similar.

Here's a popular thread for you to read:

> [@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/random-mint/26875)._
