Skip to main content

RandomNumberV2Interface

Primary interface for random number generation. This is a long-term support (LTS) interface, designed to ensure continuity even as underlying contracts evolve or protocols migrate to new versions.

Sourced from RandomNumberV2Interface.sol on GitHub.

Functions

getRandomNumber

Returns the current random number, its timestamp and the flag indicating if it is secure.

function getRandomNumber(
) external view returns (
uint256 _randomNumber,
bool _isSecureRandom,
uint256 _randomTimestamp
);

Returns

  • _randomNumber: The current random number.
  • _isSecureRandom: The flag indicating if the random number is secure.
  • _randomTimestamp: The timestamp of the random number.

getRandomNumberHistorical

Returns the historical random number for a given _votingRoundId, its timestamp and the flag indicating if it is secure. If no finalization in the _votingRoundId, the function reverts.

function getRandomNumberHistorical(
uint256 _votingRoundId
) external view returns (
uint256 _randomNumber,
bool _isSecureRandom,
uint256 _randomTimestamp
);

Parameters

  • _votingRoundId: The voting round id.

Returns

  • _randomNumber: The current random number.
  • _isSecureRandom: The flag indicating if the random number is secure.
  • _randomTimestamp: The timestamp of the random number.