#include #include #cs Mod10 Number Generator Made by : Melba23 @ https://www.autoitscript.com/forum Date : May 19th 2015 #ce ; Create file $sFile = "c:\temp\Test_mod10.csv" $hFile = FileOpen($sFile, $FO_OVERWRITE) $sLine = "" ; Produce numbers (100 here as an example) For $i = 1 To 10 ; Create a random number $sNumber = String(1000000 + Random(0, 1000000, 1)) ; Calculate a check digit $iCheckSum = 0 For $j = 1 To 7 $iCheckSum += StringMid($sNumber, $j, 1) Next $iCheckDigit = Mod($iChecksum, 10) ; Add the number and check digit to the line $sLine &= $sNumber & "" & $iCheckDigit & @CRLF ; Write every a line to the file every 5 numbers If Mod($i, 5) = 0 Then $sLine = StringTrimRight($sLine, 1) FileWrite($hFile, $sLine ) $sLine = "" EndIf Next ; Close the file FileClose($hFile) ; And here is the result $sData = FileRead($sFile) MsgBox($MB_SYSTEMMODAL, "Random", $sData)