# Tutorial 43: On-Chain Randomness

{% hint style="info" %}
[**Book an audit with Zokyo**](https://www.zokyo.io/)
{% endhint %}

In decentralized applications (dApps), randomness plays a crucial role in a variety of use cases, from  decentralized protocols requiring unpredictable outcomes. However, **on-chain randomness** introduces significant challenges in ensuring that the random values generated are not predictable or exploitable by malicious actors. When randomness is generated directly on-chain, it can be subject to manipulation, making it a prime target for attackers looking to gain an unfair advantage.

In this section, we will explore how on-chain randomness is typically implemented, the potential vulnerabilities it introduces, and how these weaknesses can be exploited. By understanding the risks associated with on-chain randomness, we can discuss best practices and strategies to create more secure and tamper-resistant systems.


---

# Agent Instructions: 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:

```
GET https://zokyo-auditing-tutorials.gitbook.io/zokyo-tutorials/tutorial-43-on-chain-randomness.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
