Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

script for random number

Avatar

Level 3

Hi, I am trying to generate a random number between 1 and 999,999 in a number field when a document opens. Can anyone give me a suggestion please?

1 Reply

Avatar

Former Community Member

This is one method...

// form1.page1.subform1.randomNumber::initialize - (JavaScript, client)

this.rawValue = Math.random() * (999999 - 1) + 1;

See  https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Math/Random

Steve