> For the complete documentation index, see [llms.txt](https://docs.chiliz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chiliz.com/pt-br/desenvolver/avancado/gerar-numeros-aleatorios.md).

# Gerar números aleatórios on-chain

A aleatoriedade verdadeira é um tópico difícil em ciência da computação, e é difícil de obter por conta própria. Quando a aleatoriedade é fundamental para o seu projeto, recomendamos usar um Gerador de Números Aleatórios (RNG) de reputação reconhecida.

## O que é um RNG?

Ao produzir sequências de números que não podem ser previstas, os RNGs garantem justiça e unicidade em projetos blockchain. Isso aumenta a integridade e a confiabilidade, impedindo manipulações e garantindo resultados equitativos.

## O que isso significa para desenvolvedores na Chiliz Chain

Ao incorporar RNGs, projetos de esportes e entretenimento podem aumentar significativamente a confiança, a emoção e a justiça do que oferecem.

## Como fazer usando Pyth?

A Chiliz Chain suporta o Pyth Entropy.

O Entropy permite que desenvolvedores gerem números aleatórios de forma rápida e fácil na blockchain para aplicações como mints de NFTs, jogos e muito mais.\
Por meio do SDK Solidity, isso permite que desenvolvedores integrem facilmente RNG em suas aplicações EVM.

{% hint style="info" %}
Use o seguinte endereço para usar Entropy com a Chiliz.

#### Na Chiliz Mainnet

* Chain ID:\
  `chiliz`
* Endereço do Contrato Entropy:\
  `0x0708325268dF9F66270F1401206434524814508b`
* Provider:\
  `0x52DeaA1c84233F7bb8C8A45baeDE41091c616506`<br>

#### Na Spicy Testnet

* Chain ID:\
  `chiliz-spicy`
* Endereço do Contrato Entropy:\
  `0xD458261E832415CFd3BAE5E416FdF3230ce6F134`
* Provider:\
  `0x6CC14824Ea2918f5De5C2f75A9Da968ad4BD6344`
  {% endhint %}

O Pyth oferece um conjunto completo de [documentação sobre Entropy](https://docs.pyth.network/entropy), incluindo:

* [Crie sua primeira aplicação Entropy no EVM](https://docs.pyth.network/entropy/create-your-first-entropy-app)
* [Como Gerar Números Aleatórios em Contratos EVM Usando Pyth Entropy](https://docs.pyth.network/entropy/generate-random-numbers/evm)
* [Uma aplicação de exemplo demonstrando como usar o Pyth Entropy para lançar uma moeda justa](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/examples/coin_flip/contract/src/CoinFlip.sol).


---

# 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.chiliz.com/pt-br/desenvolver/avancado/gerar-numeros-aleatorios.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.
