diff --git a/docs/en/sql-reference/functions/other-functions.md b/docs/en/sql-reference/functions/other-functions.md index 9aa26f32b18..3ae7fc6a212 100644 --- a/docs/en/sql-reference/functions/other-functions.md +++ b/docs/en/sql-reference/functions/other-functions.md @@ -1200,4 +1200,41 @@ SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers └────────┴────────────────────────────────┴──────────────────────────────────┘ ``` +## randomStringUTF8 {#randomstringutf8} + +Generates a random string of a specified length. Result string contains valid UTF-8 symbols. + +**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 2c715cd15a5..5c111a6133b 100644 --- a/docs/ru/sql-reference/functions/other-functions.md +++ b/docs/ru/sql-reference/functions/other-functions.md @@ -1153,4 +1153,41 @@ SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers └────────┴────────────────────────────────┴──────────────────────────────────┘ ``` +## 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/)