apoc.text.random
Function APOC Core
apoc.text.random(length, valid) YIELD value - generate a random string
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" |