One approach for favouring the unpopular answers would be to weight by the reciprocal of the votes, so jellyfish would be 10 times likelier to show up than alligator. Another would be to replace $v votes by $max + $min - $v (which would have the same jellyfish to alligator ratio, but would weight the middle choices differently).
Note that the reciprocal approach can use the same algorithm as 'popular()' if you remove the unnecessary int(...) from its first line. The min/max approach would work with or without that change.
In reply to Re: Randomly choosing from a set of alternatives with varying popularity
by hv
in thread Randomly choosing from a set of alternatives with varying popularity
by ibm1620
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |