random.generateInt(options)

Note:

The content in this help topic pertains to SuiteScript 2.1

Method Description

Method used to generate cryptographically strong pseudorandom number.

Returns

string

Supported Script Types

Client and server scripts

For additional information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/crypto/random Module

Since

2023.1

Parameters

Parameter

Type

Required/Optional

Description

options.max

number

required

End of random range (exclusive).

options.min

number

optional

Start of random range. Default is 0.

Syntax

Note:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/crypto/random Samples.

            //Add additional code
... 
// generate random number between 0 and 100 (excluded)
var number = random.generateInt({max:100});
// generate random number between 10 and 100 (excluded)
var anotherNumber = random.generateInt({min: 10, max:100});
...
//Add additional code 

          

General Notices