Randomizer example



        return implode(' ', $parts);
    }

    /** * @return callable(int,int):int */
    private static function hashEngine(string $context): callable
    {
        if (class_exists(Randomizer::class)) {
            $randomizer = new Randomizer(new Xoshiro256StarStar(hash('sha256', $context, true)));

            return static fn ($start$end) => $randomizer->getInt($start$end);
        }

        $counter = 0;

        return static function D$start$end) use ($context, &$counter) {
            $possibleValues = range($start$end);
            ++$counter;

            return $possibleValues[(int) fmod(hexdec(substr(md5($context.'-'.$counter), 0, 10)), \count($possibleValues))];
        };
Home | Imprint | This part of the site doesn't use cookies.