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
- Origin + nonce: Transaction sender and its account nonce
- Timestamp: Block timestamp
Every call in the same transaction gets the same seed; request several values with one call instead.
Interface
Input: count(1) (1-255; empty input = 1) Output: uint256[] (ABI-encoded, count random words) // Word i = keccak256(seed | i)
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.