Softtech
asked on
123456789 to 482176935
I am looking for suggestions on how to handle the following task using Delphi 3...
Assuming I have a text file which contains 1000 lines of text (the 1000 could vary, BTW)... I would like to generate a new file containing the same 1000 lines of text, HOWEVER, I want the lines to be RANDOMIZED, so that...
1
2
3
4
5
6
7
8
9
...will be saved to disk as...
4
8
2
1
7
6
9
3
5
...or some other randomized order.
Any suggestions on the best method to do this?
Assuming I have a text file which contains 1000 lines of text (the 1000 could vary, BTW)... I would like to generate a new file containing the same 1000 lines of text, HOWEVER, I want the lines to be RANDOMIZED, so that...
1
2
3
4
5
6
7
8
9
...will be saved to disk as...
4
8
2
1
7
6
9
3
5
...or some other randomized order.
Any suggestions on the best method to do this?
If you keep your lines in a TStringList, and made a randomizer your customsort function, each call to it would randomize the order of the list. Look at the docs on customsort.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Following...®
ASKER
retep...it works fine for my purposes. Thanks!