Note that there are some explanatory texts on larger screens.

plurals
  1. POAlgorithm to perform weighted shuffle with gradual bubbling up of list items
    primarykey
    data
    text
    <p>I'm wondering if anyone knows of a simple algorithm for performing a shuffle of a list that permits a weight bias so that each item in the list works its way toward the top of the list at the same time.</p> <p>I am working on a site with business listings in paginated directories and the listings need to display fairly so one business cannot always be above/below another listing. A pure shuffle of the directories is not really sufficient as the random nature of this may result in any given business randomly shuffling to a similar location within the list for an extended period of time, so I'd like to provide some weighting so that each listing is slowly nudged up the list so that they get a reasonably equal opportunity to display on the first page of the directory over time.</p> <p>EDIT:</p> <p>With thanks from Kevin - I'm attempting to formalise these rules:</p> <p>1) for n listings each listing must display in position one once in n "quasi shuffles")</p> <p>2) (fuzzy) the average (?) position of a listing should increase over time until it reaches position 1</p> <p>3) for any two businesses (A and B) over n iterations of the shuffle A must not be above B more than 50% of the time?</p> <p>I should also add that I work for a business that has an extremely complex and convoluted "Shuffler" that is necessary to pacify a large number of paying clients who insist on being fairly distributed across their business's respective categories within our directories. Complaints from customer is a "real" problem, given that users typically pick items from the first couple of paginated pages it is not fair to order clients by alphabetical order (by default), and given that users read from top to bottom, it's not fair that one business is always above another.</p> <p>I'm interested to know whether anyone has a tidy solution to this problem that they may have implemented previously.</p> <p>EDIT:</p> <p>One thought I've had, given these items are stored in the database, I could have a column which is the sum of each listings position over time, which I could use for ordering (descending), when an item reaches the first position in the list I could then set it to 0 which would mean that every item in the list would eventually make it to the top of the list. The problem is that for a large number of listings, over time, this number could become rather large...</p> <p>EDIT:</p> <p>I don't want to slam the database and I need consistency whilst a user is browsing therefore I will only be performing the "pseudo shuffle" on a nightly basis (once a day) not on every display of the directories</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload