You are here

function views_handler_sort_random in Views (for Drupal 7) 5

1 string reference to 'views_handler_sort_random'
node_views_tables in modules/views_node.inc
This include file implements views functionality on behalf of node.module

File

modules/views_node.inc, line 762

Code

function views_handler_sort_random($action, &$query, $sortinfo, $sort) {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $query
        ->add_orderby('', "rand()", "ASC", 'random_sort');
      break;
    case 'pgsql':
      $query
        ->add_orderby('', "random()", "ASC", 'random_sort');
      break;
  }
}