Random

This document describes the Random library available in the JavaScript environment for app serivices.

Table of content

Object Random
Functions dword
bytes
string

Random

dword
Generates a random 32bit number ranging from 0 to 4294967295 (0x00000000 to 0xffffffff).

Return value

unsignedThe random number.
var rand = Random.dword();
bytes
Creates random bytes.

Parameters

unsigned sizeThe number of bytes that shall be returned.
bool binaryOptional, defaulting to false. If false, a hexstring is returned. If true, a Uint8Array containing the random bytes is returned.

Return value

string / Uint8ArrayThe hexstring or Uint8Array representing the generated random bytes.
var random128BitKey = Random.bytes(16);
string
Creates a random string.

Parameters

unsigned sizeThe desired length of the generated random string.

Return value

stingThe generated random string.
var randomPassword = Random.string(24);