mojehyip Posted July 9, 2012 Posted July 9, 2012 (edited) I found in some threads this script$pwd = ",besprzesady" Dim $aSpace[3] $digits = 5 For $i = 1 To $digits $aSpace[2] = Chr(Random(48, 57, 1)) ;0-9 $pwd &= $aSpace[Random(0, 2, 1)] Next ConsoleWrite("Your password (" & $digits & " digits): " & $pwd & @CRLF)Now i change it for:Next $random2 = "I maked number: " Dim $aSpace2[3] $digits2 = 3 For $i2 = 1 To $digits2 $aSpace2[2] = Chr(Random(48, 57, 1)) ;0-9 $random2 &= $aSpace2[Random(0, 2, 1)] If $random2 > 1 Then $random2 = ("14") endif NextBut sometimes its get "0" i tryed change line$random2 &= $aSpace2[Random(0, 2, 1)]After this, autoit compile show error:G:Documents and SettingsSharecashPulpitProgramantdsw.plDOdawanie pytanskrypt.au3 (48) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $random2 &= $aSpace2[Random(1, 3800, 1)] $random2 &= ^ ERRORI want get number only from 1 to 3800. But its not working.I read the HELP and there was information about X & A.X = Min infoA = Max infoWhy its not working ?Random(X, A, 1)Min [optional] The smallest number to be generated. The default is 0.Max [optional] The largest number to be generated. The default is 1.Did i maked some wrong? Tell me Edited July 9, 2012 by mojehyip
John Posted July 9, 2012 Posted July 9, 2012 (edited) You set the maximum array index to 3 with Dim $aSpace2[3] Then with $random2 &= $aSpace2[Random(1, 3800, 1)] You have allowed this index to be anywhere between 1 and 3800. So if random rolls a 5 then you get $random2 &= $aSpace2[5] Which exceeds the max index of 3. Edit: Added Dim keyword Edited July 9, 2012 by John
mojehyip Posted July 9, 2012 Author Posted July 9, 2012 You set the maximum array index to 3 with Dim $aSpace2[3] Then with $random2 &= $aSpace2[Random(1, 3800, 1)] You have allowed this index to be anywhere between 1 and 3800. So if random rolls a 5 then you get $random2 &= $aSpace2[5] Which exceeds the max index of 3. Edit: Added Dim keyword btw. I used $random2 = Random(1, 3000, 1) = and this work
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