# RAND\_EVENT

The SQL function [RAND()](/docs/server/reference/sql-functions/numeric-functions/rand.md) generates a random number.

A `RAND_EVENT` contains two seed values that set the [rand\_seed1](/docs/server/server-management/variables-and-modes/server-system-variables.md#rand_seed1) and [rand\_seed2](/docs/server/server-management/variables-and-modes/server-system-variables.md#rand_seed2) system variables that are used to compute the random number.

{% hint style="info" %}
It is written only before a `QUERY_EVENT` , and not used with row-based logging.
{% endhint %}

## Header

* Event Type is `13` (`0x0d`).

## Fields

* [uint<8>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#fixed-length-integers) The value for the first seed.
* [uint<8>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#fixed-length-integers) The value for the second seed.

## Example From mysqlbinlog Utility, No CRC32

```sql
# at 389
#171206 13:46:56 server id 10116  end_log_pos 424 	Rand
SET @@RAND_SEED1=685157301, @@RAND_SEED2=758850369/*!*/;
# at 424
```

## Example Event as Written to the Binlog File

`c0 e6 27 5a 0d 84 27 00 00 23 00 00 00 a8 01 00 ..'Z..'..#...... 00 00 00 b5 ab d6 28 00 00 00 00 41 23 3b 2d 00 ......(......... 00 00 00 ....`

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# 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://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/rand_event.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.
