ERC721 safeMint question


My question is, is it possible to _safeMint random nft id using open zeppelin library ? I heard about chainlink, but I don’t want to use it.


Without offchain data you can't achieve Full randomndess but only pseudo one

And that’s exactly what I want to achieve. A pseudo random

Then you can use data like block.coinbase, block.difficulty etc

1 Like

Thank You for answer. Is there an example so that I can check and use with openzeppelin library and _safeMint function ?

Or at least how to implement it with _safeMint ?

Just like FreezyEx said, you can use some global variables, but, it is not a good idea.
One of the possible ways is:

uint256 randomId = uint256(keccak256(abi.encodePacked(block.difficulty)));

Thanks for all the answers and your time!