function Connection::sqlFunctionRand

Same name in other branches
  1. 9 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::sqlFunctionRand()
  2. 10 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::sqlFunctionRand()
  3. 11.x core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::sqlFunctionRand()

SQLite compatibility implementation for the RAND() SQL function.

File

core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php, line 290

Class

Connection
SQLite implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\Core\Database\Driver\sqlite

Code

public static function sqlFunctionRand($seed = NULL) {
    if (isset($seed)) {
        mt_srand($seed);
    }
    return mt_rand() / mt_getrandmax();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.