# random()

Generates an random number.

```cpp
uint32_t random(uint32_t maxval)
uint32_t random(uint32_t minval, uint32_t maxval)
```

The first line returns the value of `0.. (maxval-1)` value is returned. Note that the value of **maxval is not the maximum value**.

The second line returns the value of `minval..maxval-1`.


---

# 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://mwx.twelite.info/latest_en/api-reference/funcs/systemfunc/random.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.
