Random line in file

a guest Nov 14th, 2019 124 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Array.au3>
  2. $array = FileReadToArray('file.txt')
  3. For $i = UBound($array) - 1 To 0 Step -1
  4.     $line = Random(0, $i, 1)
  5.     FileWriteLine('file2.txt', $array[$line])
  6.     _ArrayDelete($array, $line)
  7. Next
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand