Topics - dreats [ switch to compact view ]

Pages: [1]
1
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:

10, helloworld
10, foobar

50/50 chance either would be displayed. In contrast, if it was:

518572, helloworld
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.

Pages: [1]
Go to full version