MattX Posted January 16, 2005 Share Posted January 16, 2005 Dim $word = "" $R = Random(1, 81520) msgbox(4096, "", $R ) How do I change this so the random number is not a decimal ? I just need it to be a whole number. Link to comment Share on other sites More sharing options...
this-is-me Posted January 16, 2005 Share Posted January 16, 2005 (edited) $R = Round(Random(1, 81520)) EDIT: or use Int() Edited January 16, 2005 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
ezzetabi Posted January 16, 2005 Share Posted January 16, 2005 (edited) thick Dim $word = "" $R = Int(Random(1, 81521)) msgbox(4096, "", $R ) Int is a little better than Round since it is faster: $t = TimerInit() For $c = 1 to 100000 Int(Random(0,10)) Next MsgBox(0,'',TimerDiff($t)) $t = TimerInit() For $c = 1 to 100000 Round(Random(0,9)) Next MsgBox(0,'',TimerDiff($t)) Edited January 16, 2005 by ezzetabi Link to comment Share on other sites More sharing options...
MattX Posted January 16, 2005 Author Share Posted January 16, 2005 As usual, many thanks guys. Link to comment Share on other sites More sharing options...
Administrators Jon Posted January 16, 2005 Administrators Share Posted January 16, 2005 In the beta version I've also added a flag to force INT values. It bugged me. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
MattX Posted January 16, 2005 Author Share Posted January 16, 2005 Well with your help I finished my sad password generator script. I know there are loads of free ones out there etc but it makes me feel better that the one thats gonna be used on the network has something of 'me' in it. :"> ; AutoIt Version: 3.00; Language: English; Platform: WinXP; Author: Matt ; Script Function: Password Generator from words file$__msgbox = MsgBox(4, 'Password Generator By Matt ', 'This Will Generate A Password For You, Continue?')if ($__msgbox = 7) Then ExitEndIfDim $word = ""$R = Round(Random(1, 81520))$word = FileOpen("C:\words.txt", 0)If $word = -1 Then MsgBox(0, "Error", "Unable to open file.") ExitEndIfSplashTextOn("Password Generator By Matt ", "Thinking Of A Password, Please Wait...", 300, 75)Sleep(3000)FileClose($word)$word = FileReadLine("C:\words.txt", $R)SplashOff()MsgBox(64, "Your Generated Password Is:", $word) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now