tanishq-dubey / cowtab

A simple, fast, new tab page, with a retro feel and good advice.
MIT License
40 stars 8 forks source link

Amounts in files affect probability of getting fortunes inside #4

Open metarmask opened 7 years ago

metarmask commented 7 years ago

Example:

Files: 2 File A: 10 fortunes File B: 5 fortunes

P(fortune in A) = 1/2*1/10 = 1/20

P(fortune in B) = 1/2*1/5 = 2/20

bunsenmcdubbs commented 7 years ago

@metarmask you can try adding counts to the index fortune file you created in #3 and using that to even out the probabilities.

I can think of several reasons to keep the fortune files separate (potentially easier to black/whitelist certain types of fortunes, file size(?), convenience). But I think the easiest way to fix this issue is by combining all the fortunes into a single file.

tanishq-dubey commented 6 years ago

I think a better way than having one fortune file, due to the time it may take to load the file, is to have a metadata file that I can generate. We can then pick the fortune file using this metadata and then load the quote itself.