You are here

function _views_random_seed_create_int in Views random seed 6

Same name and namespace in other branches
  1. 7 views_random_seed_handler_sort_random.inc \_views_random_seed_create_int()

Helper function to create a seed based on db_type. MySQL can handle any integer in the RAND() function, Postgres needs an int between 0 and 1.

Parameters

int $time Current timestamp.:

string $db_type the current database type (mysql(i) - pgsql):

Return value

int $seed timestamp or int between 0 and 1.

1 call to _views_random_seed_create_int()
_views_random_seed_generate_seed in ./views_random_seed_handler_sort_random.inc
Helper function to generate a seed

File

./views_random_seed_handler_sort_random.inc, line 181

Code

function _views_random_seed_create_int($time, $db_type) {
  switch ($db_type) {
    case 'mysql':
    case 'mysqli':
      return $time;
      break;
    case 'pgsql':
      $seed = $time / 10000000000;
      return $seed;
      break;
  }
}