apoc.text.random
Function
apoc.text.random(length Integer, valid String)
- generates a random string to the given length using a length parameter and an optional string of valid characters.
Unsuitable for cryptographic use-cases.
Usage Examples
You can generate a random string to a specified length by calling apoc.text.random
with a length parameter and optional string of valid characters.
The valid
parameter will accept the following regex patterns, alternatively you can provide a string of letters and/or characters.
|
Description |
|
A-Z in uppercase |
|
A-Z in lowercase |
|
Numbers 0-9 inclusive |
The following call will return a random string including uppercase letters, numbers and .
and $
characters.
RETURN apoc.text.random(10, "A-Z0-9.$") AS output;
output |
---|
"V9Y7N54LO6" |
Was this page helpful?