Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

GlideSecureRandomUtil - Scoped, Global

The GlideSecureRandomUtil API provides methods for generating integers, long values, and strings.

There is no constructor for this class. Methods are accessed through the static object GlideSecureRandomUtil. The GlideSecureRandomUtil class is available in both global and scoped applications.

Parent Topic:Server API reference

GlideSecureRandomUtil - getSecureRandomInt()

Generates a pseudo-random integer.

NameTypeDescription
None  
TypeDescription
NumberThe pseudo-randomly generated integer.
gs.info(GlideSecureRandomUtil.getSecureRandomInt());

Output:

1976146969

GlideSecureRandomUtil - getSecureRandomIntBound(Number bound)

Generates a pseudo-random integer between 0 (inclusive) and the bound (exclusive) value that you pass into the method.

NameTypeDescription
boundNumberThe bound value.
TypeDescription
NumberThe pseudo-randomly generated integer.
gs.info(GlideSecureRandomUtil.getSecureRandomIntBound(100));

Output:

55

GlideSecureRandomUtil - getSecureRandomLong()

Generates pseudo-random long value.

NameTypeDescription
None  
TypeDescription
NumberThe pseudo-randomly generated 64-bit integer.
gs.info(GlideSecureRandomUtil.getSecureRandomLong());

Output:

792836514424092500

GlideSecureRandomUtil - getSecureRandomString(Number length)

Generates a random alpha-numeric String with the specified length.

NameTypeDescription
lengthNumberThe length of the string in number of characters.
TypeDescription
StringThe randomly generated string.
gs.info(GlideSecureRandomUtil.getSecureRandomString(12));

Output:

1XzVI0sLfVlT