For the complete documentation index, see llms.txt. This page is also available as Markdown.

Generate random number

Description

Create pseudo-random numbers using block hashes for randomness in smart contracts

Use Cases

  • Lottery and gaming contracts

  • Random NFT trait generation

  • Fair distribution mechanisms

  • Random selection from lists

Key Concepts

  • Block hashes - Use historical block data as entropy source

  • Future blocks - Cannot predict future block hashes

  • Commitment schemes - Combine with commit-reveal for fairness

  • Blockchain randomness is deterministic but unpredictable

Last updated

Was this helpful?