So as the question follows :). I need to save large (about 5,000,000) amount of unique numbers in random order (shuffled) into the file. I've wrote program that works only for ca. 1,000,000. It first creates an array of ordered elements then shuffle them and save each number in new line of the file. But when I'm trying to increase the amount of numbers "Segmentation fault" appears. I think that because I want to allocate so much space in memory for that array at the very beginning.
So is there a better (efficient?) way of saving that numbers? It could be saved directly to the file. I need all that numbers to do some data comparison in C