Jump to content

random() help


Kyme
 Share

Recommended Posts

hi all

i want to make some tool but i need to do random() from 1 to 999

problem it is in if random it's for ex 20 i want to make it 020 all the time to be 3 numbers if random it's 1 to be 001 how i can make it?

i try this one

Random(1, 999, 1)

but it's not all the time 3 numbers

thank you

waiting feedbacks

Regards, kyme

Edited by Kyme
Link to comment
Share on other sites

hi all

i want to make some tool but i need to do random() from 1 to 999

problem it is in if random it's for ex 20 i want to make it 020 all the time to be 3 numbers if random it's 1 to be 001 how i can make it?

i try this one

Random(1, 999, 1)

but it's not all the time 3 numbers

thank you

waiting feedbacks

Regards, kyme

Try this

$RandVal = StringFormat("%03i",Random(1, 999, 1))

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

whats the difference between yashied's and bowmore's?

Link to comment
Share on other sites

In terms of the result there is no difference.

The Random function with a flag of 1 returns and integer, so technically you could say that the string format specifier should be "i" for an integer (or "d" which is the same thing) and not "s" which is for a string. In C this would be importatnt, in AutoIt it isn't.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...