> For the complete documentation index, see [llms.txt](https://docs.scry.finance/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scry.finance/docs/morpheus/contract-use-and-request-feeds/vrf.md).

# VRF

To request a Verifiable Random Function (VRF) feed, use the `requestFeeds` function with 'vrf' as the endpoint. Optionally, include a unique identifier or "salt" in the APIendpointpath to ensure each VRF, preventing potential influence by the oracle. The oracle will return the VRF as a 256-bit unsigned integer (uint256). Note that each request generates a unique feed ID, so for each new VRF, a separate `requestFeeds` call is required. More info in\
[https://docs.scry.finance/docs/morpheus/vrf-hash-ranch](#vrf)

**Sample**

<pre class="language-solidity"><code class="lang-solidity">// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface Morpheus {
    function getFeed(
        uint256 feedID
    )
        external
        view
        returns (
            uint256 value,
            uint256 decimals,
            uint256 timestamp,
            string memory valStr
        );

    function requestFeeds(
        string[] calldata APIendpoint,
        string[] calldata APIendpointPath,
        uint256[] calldata decimals,
        uint256[] calldata bounties
    ) external payable returns (uint256[] memory feeds);
}

contract VRF{
    Morpheus public morpheus;
    uint vrfID;
    uint oracleFee = 100000000000000;
    address winner;
    address player;
    constructor() {
        morpheus = Morpheus(0x0000000000071821e8033345A7Be174647bE0706);
    }

    function play() public{
     require(msg.value>=oracleFee);
    require(player==address(0));
   player=msg.sender;
     requestVRF();
    }


    function requestVRF() internal {
        string[] memory apiEndpoint = new string[](1);
        apiEndpoint[0] = "vrf";
        string[] memory apiEndpointPath = new string[](1);
        apiEndpointPath[0] = "";
        uint256[] memory decimals = new uint256[](1);
        decimals[0] = 0;
        uint256[] memory bounties = new uint256[](1);
        bounties[0] = oracleFee ;
        uint256[] memory feeds = morpheus.requestFeeds{value: oracleFee }(
            apiEndpoint,
            apiEndpointPath,
            decimals,
            bounties
        );
    vrfID= feeds[0];
    }

    function determineWinner() public {
        require(
            vrfID!=0
        );
        (uint256 vrfValue, , , ) = morpheus.getFeed(vrfID);
        require(vrfValue != 0, "Oracle not ready");
        uint256 roll = (vrfValue % 100) + 1;
        if (roll>51){winner=player;}
<strong>        player=address(0);
</strong>    }
}
</code></pre>

### **See for more info**

{% content-ref url="/spaces/v8JXJiVYHraB1HHgM4ge/pages/re987b0jDYi78WGmBYsr" %}
[VRF Hash RanCh](/docs/morpheus/vrf-hash-ranch.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.scry.finance/docs/morpheus/contract-use-and-request-feeds/vrf.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
