randomBytes

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
randomBytes(<byteCount>)
Summary

Returns byteCount random bytes.

Introduced4.6
OSmac, windows, linux
Platformsdesktop, server
Parameters
NameTypeDescription
byteCount

A number specifying how many random bytes to generate.

Example
randomBytes(10)
randomBytes(the number of characters of myVar)
Values
NameTypeDescription
return

The randomBytes function returns byteCount random bytes.

RelatedProperty: randomSeed
Function: random
Description

Use the randomBytes function to generate cryptographic-quality random data.

The randomBytes function returns byteCount random bytes using the OpenSSL library's random data generator to do so.

The random data is derived from non-predictable sources where possible, meaning that it can (for the most part) be considered truly random. This is contrast to the random function which uses a pseudo-random number generator and randomSeed value.

Note: Make sure the security library is included when building applications that use this function as a standalone. If the library cannot be found at runtime, the function with throw an error.

Tagsmath