in reply to Re: Randomizing Big Files
in thread Randomizing Big Files

Just sort the line numbers won't work since my lines doesn't have fixed size! So, when I will create the new file I will always search for that line what will be very slow.

Can work if we create a support algorithm to search the lines, using some know lines to be the start to search the others, but we can't forget that will still be slow since the file is too big!

Replies are listed 'Best First'.
Re^3: Randomizing Big Files
by samizdat (Vicar) on Jan 26, 2005 at 17:18 UTC
    Another question: How many times do you need to do this? Why is efficiency so important? If you only need to do it once, just code it, run it, and be done. :D
      If you only need to do it once, just code it, run it, and be done.

      We need something eficient because with a normal code is just impossible to run with a file of 4Gb! I just don't have 1Gb of Ram to be able to load everything in the memory.

Re^3: Randomizing Big Files
by samizdat (Vicar) on Jan 26, 2005 at 17:16 UTC
    Thanks to Aristotle for the seek correction!

    New suggestion: Okay, read by character, building array of positions of '\n's. Shuffle that, then read between the '\n's. into new file.