Supported Versions: PHP 7, PHP 8
Get a cryptographically secure, uniformly selected integer
<?php random_int(int $min, int $max): int
<?php             $acquired = $updated >= 1;

        }



        if (random_int(1, $this->lottery[1]) <= $this->lottery[0]) {

            $this->connection->table($this->table)->where('expiration', '<=', $this->currentTime())->delete();

        }
<?php     protected function configHitsLottery(array $config)

    {

        return random_int(1, $config['lottery'][1]) <= $config['lottery'][0];

    }
<?php     protected static function resultFactory()

    {

        return static::$resultFactory ?? fn ($chances, $outOf) => $outOf === null

            ? random_int(0, PHP_INT_MAX) / PHP_INT_MAX <= $chances

            : random_int(1, $outOf) <= $chances;

    }
<?php     {

        return static::$resultFactory ?? fn ($chances, $outOf) => $outOf === null

            ? random_int(0, PHP_INT_MAX) / PHP_INT_MAX <= $chances

            : random_int(1, $outOf) <= $chances;

    }
<?php                 ']', '|', ':', ';',

            ] : null,

            'spaces' => $spaces === true ? [' '] : null,

        ]))->filter()->each(fn ($c) => $password->push($c[random_int(0, count($c) - 1)])

        )->flatten();



        $length = $length - $password->count();
<?php         $length = $length - $password->count();



        return $password->merge($options->pipe(

            fn ($c) => Collection::times($length, fn () => $c[random_int(0, $c->count() - 1)])

        ))->shuffle()->implode('');

    }
<?php     public function testDefaultCacheLifeTimeIsSetOnTaggableStore()

    {

        $repo = new Repository(new ArrayStore());

        $repo->setDefaultCacheTime(random_int(1, 100));



        $store = $repo->tags('foo');
<?php     public function register()

    {

        $this->app->bind('one.time.password', function () {

            return random_int(1, 10);

        });



        Queue::createPayloadUsing(function () {
<?php     public function testRandom()

    {

        $this->assertEquals(16, strlen(Str::random()));

        $randomInteger = random_int(1, 100);

        $this->assertEquals($randomInteger, strlen(Str::random($randomInteger)));

        $this->assertIsString(Str::random());

    }