Randomnode
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Component created
Component changed
Component body
Optimized and scalable random node selection. Provides path direction (randomnode-redirect/story -> node/47). Creates an equally-distributed node ID lookup table for surer random results.
The original concept for the query that this module is based on can be found in this write-up. Essentially, the module maintains a sequential ID field and ensures that holes (i.e. node deletions) are filled so that the random selection is not inadvertently weighted. This sequential ID is then used by the query to select a random row with an ID between the lowest and highest values.
Since the building of the lookup table could potentially be time- or resource-consuming, it is built only when enabled per type on the node type form. Multiple node types can be selected, but the mappings are kept separate, i.e. random selections are restricted to nodes of a single node type.
This module provides a randomnode_get() function for developers to use that returns a random node ID.
This module also provides a menu callback that redirects to a random node/% path. This could be aliased to something more fun like "random" or "try-your-luck".
An older, more site-specific version of this module is in use at My Band Needs a Name.
