Skip to main content

randomBytes

Type​

function

Summary​

Returns byteCount random bytes.

Syntax​

randomBytes(<byteCount>)

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.

Parameters​

NameTypeDescription

byteCount

A number specifying how many random bytes to generate.

Examples​

randomBytes(10)
randomBytes(the number of characters of myVar)

Value​

NameTypeDescription

return

The randomBytes function returns byteCount random bytes.

function: random

property: randomSeed

Compatibility and Support​

Introduced

LiveCode 4.6

OS

mac

windows

linux

Platforms

desktop

server

Thank you for your feedback!

Was this page helpful?