@astra-js/rng

1.0.3 • Public • Published

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;
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @astra-js/rng

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

1.17 kB

Total Files

3

Last publish

Collaborators

  • astra-network