Jump to content

making random numbers


Recommended Posts

The answers above are not going to guarantee an eight digit number which the OP asked for.

You either need

$ans = Random(10000000,99999999,1)

or using the loop idea

$ans = random(1,9,1)

for $n = 1 to 7

$ans &= random(0,9,1)

next

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

The answers above are not going to guarantee an eight digit number which the OP asked for.

Do you refer to post #3? Cus it will. Unless you don't count 00000000, in which case it's just a difference of opinions. :D

$sRandom = StringFormat("%08u", Random(0,99999999,1))
MsgBox(0,0,$sRandom)oÝ÷ غ(Ébï'ºfÞ®Ëhá/z{aÆ®¶­sbb33c·5&æFöÒÒ7G&ætf÷&ÖBgV÷C²SRgV÷C²Â¤×6t&÷ÃÂb33c·5&æFöÒ

Is technically 8 numbers. :P

Link to comment
Share on other sites

Do you refer to post #3? Cus it will. Unless you don't count 00000000, in which case it's just a difference of opinions. :D

$sRandom = StringFormat("%08u", Random(0,99999999,1))
MsgBox(0,0,$sRandom)oÝ÷ غ(Ébï'ºfÞ®Ëhá/z{aÆ®¶­sbb33c·5&æFöÒÒ7G&ætf÷&ÖBgV÷C²SRgV÷C²Â¤×6t&÷ÃÂb33c·5&æFöÒ

Is technically 8 numbers. :P

Yes, zero is a digit so maybe I'm wrong.

I personally wouldn't accept 01 or 00 as being 2 digit numbers, but I would accept them as a 2-digit strings.

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

I have found that this script is most effective for what I needed.

CODE
Global $sRandom

For $i = 1 to 8

$sRandom &= Random(0,9,1)

next

Send($sRandom)

However, now I need the random number to be between 10000000 and 37000000.

Thank You to everyone who tried to help me out previously.

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...