diff --git a/docs/en/sql-reference/functions/other-functions.md b/docs/en/sql-reference/functions/other-functions.md index 9c72f0611b2..f6a831ae080 100644 --- a/docs/en/sql-reference/functions/other-functions.md +++ b/docs/en/sql-reference/functions/other-functions.md @@ -1350,4 +1350,42 @@ len: 30 - [generateRandom](../../sql-reference/table-functions/generate.md#generaterandom) - [randomPrintableASCII](../../sql-reference/functions/other-functions.md#randomascii) + +## randomStringUTF8 {#randomstringutf8} + +Generates a random string of a specified length. Result string contains valid UTF-8 code points. The value of code points may be outside of the range of assigned Unicode. + +**Syntax** + +``` sql +randomStringUTF8(length); +``` + +**Parameters** + +- `length` — Required length of the resulting string in code points. [UInt64](../../sql-reference/data-types/int-uint.md). + +**Returned value(s)** + +- UTF-8 random string. + +Type: [String](../../sql-reference/data-types/string.md). + +**Example** + +Query: + +```sql +SELECT randomStringUTF8(13) +``` + +Result: + +```text +┌─randomStringUTF8(13)─┐ +│ 𘤗𙉝д兠庇󡅴󱱎󦐪􂕌𔊹𓰛 │ +└──────────────────────┘ + +``` + [Original article](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/ru/sql-reference/functions/other-functions.md b/docs/ru/sql-reference/functions/other-functions.md index c6648963dad..ad14d665620 100644 --- a/docs/ru/sql-reference/functions/other-functions.md +++ b/docs/ru/sql-reference/functions/other-functions.md @@ -1334,4 +1334,42 @@ len: 30 - [randomPrintableASCII](../../sql-reference/functions/other-functions.md#randomascii) +## randomStringUTF8 {#randomstringutf8} + +Генерирует строку определенной длины со случайной строкой в кодировке UTF-8. + +**Синтаксис** + +``` sql +randomStringUTF8(length); +``` + +**Параметры** + +- `length` — Длина итоговой строки в кодовых точках. [UInt64](../../sql-reference/data-types/int-uint.md). + +**Возвращаемое значение** + +- Случайная строка в кодировке UTF-8. + +Тип: [String](../../sql-reference/data-types/string.md). + +**Пример** + +Запрос: + +```sql +SELECT randomStringUTF8(13) +``` + +Результат: + +```text +┌─randomStringUTF8(13)─┐ +│ 𘤗𙉝д兠庇󡅴󱱎󦐪􂕌𔊹𓰛 │ +└──────────────────────┘ + +``` + + [Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/other_functions/)