Set objRandom = CreateObject( "System.Random" ) Wscript.Echo objRandom.Next_2( 1, 100 ) Wscript.StdOut.Write "This script reads in a file and randomises it's lines." Wscript.StdOut.Write "THERE IS A HARDCODED LIMIT on the number of lines output" dim fs,objTextFileOut set fs=CreateObject("Scripting.FileSystemObject") 'Wscript.StdOut.Write "Enter a Decimal Number: " 'strDecimal1 = Wscript.StdIn.ReadLine 'Wscript.StdOut.WriteLine "You typed: " & strDecimal1 'filename = InputBox("Give me a filename to process","Split csv file") set args = WScript.Arguments num = args.Count if num = 0 then Wscript.StdOut.Write "Enter a filename to process: " filename = Wscript.StdIn.ReadLine Wscript.StdOut.WriteLine "You typed: " & filename else filename = args.Item(0) Wscript.StdOut.WriteLine "processing " & filename end if Wscript.StdOut.WriteLine "Starting at " & now() set objTextFileOut = fs.CreateTextFile("random_" & filename) Const ForReading = 1 Set objFso = CreateObject("Scripting.FileSystemObject") Set objFile = objFso.OpenTextFile(filename, ForReading) arrLines = Array() intCounter = 0 Do Until objFile.AtEndOfStream ReDim Preserve arrLines(intCounter) arrLines(intCounter) = objFile.ReadLine intCounter = intCounter + 1 Loop objFile.Close Dim intArray() ReDim Preserve intArray(intCounter) for i = 0 to intCounter intArray(i) = 0 Next upperbound = intCounter - 1 upperbound2 = intCounter lowerbound = 0 Wscript.StdOut.WriteLine "upperbound = " & upperbound total = 0 for i = 0 to intCounter index = Int( ( upperbound - lowerbound + 1 ) * Rnd + lowerbound ) 'not really random at all... index = objRandom.Next_2( lowerbound, upperbound2 ) 'better .NET random Wscript.StdOut.WriteLine index if intArray(index) = 0 then Wscript.StdOut.WriteLine "using " & index objTextFileOut.Writeline arrLines(index) intArray(index) = 1 total = total + 1 'put limit on output file if total = 300000 then Wscript.StdOut.WriteLine "HIT OUTPUT LIMIT. UPDATE FILE TO CHANGE THIS. HIT OUTPUT LIMIT." i = intCounter end if else if total = intCounter then i = intCounter else i = i -1 end if end if Next objTextFileOut.Close set objTextFileOut = Nothing set fs = Nothing Wscript.StdOut.WriteLine "Ending at " & now()