1
Finished Programs / DONE: A script to display a random line from txt file
« on: February 20, 2006, 03:44 AM »
This may seem useless to most, so if it's too difficult to make I am willing to donate a few coins, if it is allowed, to spur some motivation.
I need a script that will work something like this: once executed it will output a random line from a specified text file.
Except, there would be a little probability involved.
Each line in this text file is specially formatted in a particular syntax: "<NUMBER>, <TEXT>". The number represents the probability of the text to display in cumulative percentage.
Take for example this txt file with these two lines in it:
50/50 chance either would be displayed. In contrast, if it was:
99.9% you'll see "helloworld".
Let me know how feasible it is. I will donate to either the site or the coder. 15-20$ depending on difficulty sounds ok? I really don't know.
I need a script that will work something like this: once executed it will output a random line from a specified text file.
Except, there would be a little probability involved.
Each line in this text file is specially formatted in a particular syntax: "<NUMBER>, <TEXT>". The number represents the probability of the text to display in cumulative percentage.
Take for example this txt file with these two lines in it:
10, helloworld
10, foobar
10, foobar
50/50 chance either would be displayed. In contrast, if it was:
518572, helloworld
10, foobar
10, foobar
99.9% you'll see "helloworld".
Let me know how feasible it is. I will donate to either the site or the coder. 15-20$ depending on difficulty sounds ok? I really don't know.