IHederaPrngAdapter
Title: IHederaPrngAdapter
Author: Modified from hiero-ledger/hiero-contracts (https://github.com/hiero-ledger/hiero-contracts)
Interface for the HederaPrngAdapter Diamond facet — consensus-derived randomness from the PRNG system contract (HIP-351), the Hedera-native counterpart of the VRF / Entropy adapters.
Unlike VRF, the seed is available synchronously in the same transaction (no request / fulfil round
trip) and is derived from the previous transaction record's running hash — not manipulable by the
caller, but visible to the node that orders the transaction. Not a view: the network records the
draw as a child transaction.
Functions
drawSeed
Draws a fresh 32-byte seed.
function drawSeed() external returns (bytes32 seed);Returns
| Name | Type | Description |
|---|---|---|
| seed | bytes32 |
drawInRange
Draws a seed and reduces it to a number in [lo, hi).
function drawInRange(uint32 lo, uint32 hi) external returns (uint32 number);Parameters
| Name | Type | Description |
|---|---|---|
| lo | uint32 | |
| hi | uint32 |
Returns
| Name | Type | Description |
|---|---|---|
| number | uint32 |
Events
HederaSeedDrawn
Emitted on every draw.
event HederaSeedDrawn(bytes32 seed, address indexed requester);Parameters
| Name | Type | Description |
|---|---|---|
| seed | bytes32 | |
| requester | address |
Errors
HederaPrngCallFailed
The PRNG system contract halted.
error HederaPrngCallFailed();HederaPrngInvalidRange
lo must be less than hi.
error HederaPrngInvalidRange(uint32 lo, uint32 hi);Parameters
| Name | Type | Description |
|---|---|---|
| lo | uint32 | |
| hi | uint32 |