@astra-js/rng
v1.0.3
Published
For use as rng in smart contracts on the Astra Blockchain
Downloads
36
Readme
Astra RNG
For use as secure rng in smart contracts on the Astra Blockchain
Usage
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@astra-js/rng/rng.sol";
contract Contract is RNG {
// guess the number 1-10
function guessNumber(uint8 num) public view returns (bool) {
require(num > 0 && num <= 10, "Number has to be between 1 and 10");
uint8 computerGuess = rng() % 10;
return num == computerGuess;
}
}