Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Returns a string of the specified length whose characters are chosen uniformly at random from the following pool of characters: 0-9, a-z, A-Z. The random seed is optional. The string length must be a constant two-byte or four-byte integer (SMALLINT or INT, respectively).
For the corresponding Databricks SQL function, see randstr function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.randstr(length=<length>, seed=<seed>)
Parameters
| Parameter | Type | Description |
|---|---|---|
length |
pyspark.sql.Column or int |
Number of characters in the string to generate. |
seed |
pyspark.sql.Column or int |
Optional random number seed to use. |
Returns
pyspark.sql.Column: The generated random string with the specified length.
Examples
from pyspark.databricks.sql import functions as dbf
spark.range(0, 10, 1, 1).select(dbf.randstr(16, 3)).show()