protected function SeedCalculator::generateSeed in Views random seed 8
Helper function to generate a seed
Parameters
string $seed_name: Name of the seed.
int $time: Current timestamp.
string $db_type: The current database type (mysql(i) - pgsql).
Return value
int The seed value.
1 call to SeedCalculator::generateSeed()
- SeedCalculator::calculateSeed in src/
SeedCalculator.php - Calculate a seed.
File
- src/
SeedCalculator.php, line 126
Class
- SeedCalculator
- Calculates seeds.
Namespace
Drupal\views_random_seedCode
protected function generateSeed(string $seed_name, int $time, string $db_type) {
$seed = $this
->createInt($time, $db_type);
$user_seed_type = $this->options['user_seed_type'];
if ($user_seed_type === 'diff_per_user' && ($this->currentUser
->isAuthenticated() || $this->options['anonymous_session'])) {
$this
->debug('Generate diff per user');
$_SESSION[$seed_name] = $seed;
}
else {
$this
->debug('Generate same per user');
$this->keyValueStore
->set($seed_name, $seed);
}
return $seed;
}