face Posted September 14, 2014 Posted September 14, 2014 (edited) i have two columns of numbers i want to make it so column 1 generates from numbers 0-50 and column 2 from column 1's value to 255 max and possibly able to set how many rows (around 1000 rows) if column 1 generates = 2 column 2 generates = from 2 to 255 randomly and possibly no repeat/duplicates option Edited September 14, 2014 by face
Solution Danyfirex Posted September 14, 2014 Solution Posted September 14, 2014 almost same code I show before. #include <Array.au3> Local $if=100 Local $icol=100 Local $aRamdom[$if][$icol] Local $aRIndex[4]=[0,50,255,1000] For $f=0 to $if-1 For $c=0 to $icol-1 $aRamdom[$f][$c]=Random($aRIndex[Mod($c,3)],$aRIndex[Mod($c,3)+1],1) Next Next _ArrayDisplay($aRamdom) Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
kylomas Posted September 14, 2014 Posted September 14, 2014 (edited) face, This will generate a 2 column (2D) array where no rows repeat. There is also a dup checking and proof routine at the end... expandcollapse popup#include <array.au3> local $irows = 1000 local $aRSLT[$irows][2] local $CompStr = '', $tRND = 0 for $1 = 0 to ubound($aRSLT) - 1 $aRSLT[$1][0] = random(0,50,1) $tRND = random($aRSLT[$1][0],255,1) while stringinstr($CompStr,$aRSLT[$1][0] & '-' & $tRND & '|') > 0 $tRND = random($aRSLT[$1][0],255,1) WEnd $CompStr &= $aRSLT[$1][0] & '-' & $tRND & '|' $aRSLT[$1][1] = $tRND next _arraydisplay($aRSLT) ; ; Routine to prove array generator does not generate duplicates ; local $aCHK = stringsplit($CompStr,'|',3), $DupCnt = 0 ; to prove dup checking routine...set 499 = 500 ; $aCHK[499] = $aCHK[500] for $1 = 0 to ubound($aCHK) - 1 $DupCnt = 0 for $2 = 0 to ubound($aCHK) - 1 if $aCHK[$1] = $aCHK[$2] then $DupCnt += 1 if $DupCnt > 1 then ConsoleWrite($1 & ' dup = ' & $aCHK[$1] & @CRLF) endif Next Next kylomas edit: wording Edited September 14, 2014 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
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