How to retrieve a row, biased by populatity?

Praveen Chakravarthula praveen.chakravarthula at gmail.com
Tue Aug 21 21:59:54 BST 2012


On Tue, Aug 21, 2012 at 9:57 PM, Praveen Chakravarthula <
praveen.chakravarthula at gmail.com> wrote:

> * Pick a random number between 0 .. 1 from a non-*linear *distribution,
> multiply it by the total number of rows.
> * SELECT stuff FROM table ORDER BY weight LIMIT rand, 1
>

er.. that should read non-uniform distribution.


>
>
> On Tue, Aug 21, 2012 at 9:22 PM, Dave Hodgkinson <davehodg at gmail.com>wrote:
>
>>
>> Possibly a perl question. SQL would do...
>>
>> Given a set of data, say bands, with each having a ranking, either a
>> review metric or a sales ranking, how would you retrieve a random
>> row, but biased towards the higher ranking?
>>
>>
>


More information about the london.pm mailing list