Note: This function is supported in Avi Vantage release 18.2.5+.
||Enables users to generate cryptographically secure random bytes of data.
||num_bytes is an integer between 0 and 1024.
||A string containing num_bytes random bytes of data.
- Lua defines a string as a sequence of bytes. Therefore, manipulations valid for bytes within the ASCII range are likewise valid for bytes outside the ASCII range.
- Printing these random bytes will mostly likely show unrecognizable characters.
- Alternative methods such as
math.random cannot be relied upon to return cryptographically secure random values, such as might be needed when creating UUIDs.
||Log 8 random bytes in the VS application log:
random_bytes = avi.utils.rand_bytes(8)