DFSEC_Random¶
Include: Use System\Security.pkg
See Also: Random
Purpose¶
Fills a destination value with random bytes or readable random characters.
Syntax¶
Procedure DFSEC_Random Global Variant ByRef vValue ULongptr ulOptSize DFSEC_RANDOM_ENGINE eOptEngine
Arguments¶
vValue
: By-reference destination. Supported destinations include UChar[], String, and WString.
ulOptSize
: Optional number of bytes or characters to generate.
eOptEngine
: Optional engine. Use C_DFSEC_RANDOM_ENGINE_DEFAULT for raw bytes or C_DFSEC_RANDOM_ENGINE_ASCII for readable characters.
Valid forms¶
Send DFSEC_Random (&ucaBytes) 32
Send DFSEC_Random (&sValue) 32 C_DFSEC_RANDOM_ENGINE_ASCII
Send DFSEC_Random (&wsValue) 32 C_DFSEC_RANDOM_ENGINE_ASCII
Behavior¶
DFSEC_Random writes generated data into the destination passed by reference.
ulOptSize is optional. When it is omitted for an existing array, the current array size is used. For String and WString destinations, provide a size so the result length is deterministic.
UChar[] destinations are resized upward when possible. Fixed or smaller nested arrays can raise DFERR_BAD_PARAMETER.
Unsupported destinations include Variant, Struct, RowId, arrays of String or WString, and non-byte-array overreach cases. An invalid engine raises DFERR_BAD_PARAMETER.
C_DFSEC_RANDOM_ENGINE_ASCII uses readable characters from A-Z, a-z, 0-9, @, #, and _.
No security-strength guarantee is documented here.
Example¶
UChar[] ucaBytes
String sValue
WString wsValue
Send DFSEC_Random (&ucaBytes) 32
Send DFSEC_Random (&sValue) 32 C_DFSEC_RANDOM_ENGINE_ASCII
Send DFSEC_Random (&wsValue) 32 C_DFSEC_RANDOM_ENGINE_ASCII