Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

Level 10

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