Random Number Generator
Protocol-level entropy for games, mints, and selection0x00000000000000000000000000000000000000FF~500 gas
Generate cryptographically secure random numbers using on-chain entropy.
Click Generate to create random numbers
Why It Matters
On-chain randomness is hard. Traditional approaches (blockhash, chainlink VRF) are either exploitable or expensive. This precompile provides protocol-level randomness with 100 rounds of mixing to prevent off-chain grinding.
Entropy Sources
Protocol-generated seed (deterministic for node, unpredictable for user):
- ParentHash: Previous block's hash (high entropy)
- ChainID: Network identifier
- BlockNumber: Current block number
- Timestamp: Block timestamp
Plus optional caller-provided salt for additional entropy.
Interface
Input: bytes (optional salt) Output: bytes32 (256-bit random value) // Different salt = different outputs in same block // Same salt in different blocks = different outputs
When NOT to Use
Not for high-stakes randomness where validators could profit from manipulation. For lotteries with large prizes, use commit-reveal schemes or VRF. Perfect for: game mechanics, NFT trait selection, fair distribution.