Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How can I create 5 digit random numbers that do not begin with a zero?

Featured Replies

I need a way to create 2000 unique 5 digit random numbers that do not being with a zero. I am trying to generate them with a looping script but I am running into two problems. The first problem is that I keep getting duplicates which throws up and error because of the unique validation that I have set for the field. The second problem is that the 5 digit number cannot begin with a zero.

 

This is my current calculation:

SerialIncrement ( "00000" ; Int ( Random * 99999 ) )

Ideally I would like the script to automatically recreate another number if it encounters a duplicate instead of throwing up an error.

 

Any help would be greatly appreciated.

 

Thanks.

To generate a random 5-digit number that does not begin with zero (i.e. an integer between 10,000 and 99,999, incl.) =

Int ( Random * 90000 ) + 10000

To eliminate duplicates, you must compare the new number with a list of numbers generated so far and add the new number to the list only if it's not already there. With only 2,000 numbers to generate, you could keep the list in a variable and use the FilterValues() function to make the comparison. Once you have the required 2,000 values, exit the loop and move to creating a record for each value in the list (assuming that's where you need them).

  • Author

Thanks very much comment.

Could you sort them and step through with a counter? Your sort could introduce the "randomness"

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.