Here is a math problem for all. Trying to find the best algorithm to select a row from a database with a weight attached to it.
So say you have 3 records with weights
10
20
30
We want 30 to show up the most then 20 then 10 and so on.
The current alg selects a random # from 1 - the weight sum (in this case 60)
Then loops through adding the weight to a running total until it is >= then the random #. It worked out good but there has to be an easier way. Anyone want to throw one out there?