|
Hi all,
I hope some talented person can help me.
I have an application the generates a text file with a series of entries in it and I need to generate a file that randomly picks x amount of entries (where x is a number I need). For example
Widget1 widget2 Widget5 Widget9 Widget10
Now, the number of entries, ie widgets, can vary, from zero to 20 or more in it.
What I need to do is be able to RANDOMLY pick a predetermined number of widget entries. So that if I say pick 2 entries, I might get Widget5 and 9, then next time it might be 1 and 10.
I think I need to: 1. Read the file and create an array. 2. Work out how many entries are in the array. 3. Pick a predetermined number that I want. 4. Randomly pick some of the entries based on the number I want. 5. Then generate a new file with those random entries.
Make sense.
I need some serious help in making some code, and would seriously appreciate the help!
Thanks, Wil
|