mt_rand

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Generate a random value via the Mersenne Twister Random Number Generator
<?php mt_rand(): int
<?php     public function virtualBooleanCached(): Attribute

    {

        return Attribute::get(function () {

            return (bool) mt_rand(0, 1);

        })->shouldCache();

    }
<?php     public function virtualBoolean(): Attribute

    {

        return Attribute::get(function () {

            return (bool) mt_rand(0, 1);

        });

    }
<?php     {

        return new Attribute(

            function () {

                return Date::now()->addSeconds(mt_rand(0, 10000));

            }

        );

    }
<?php     {

        return (new Attribute(

            function () {

                return Date::now()->addSeconds(mt_rand(0, 10000));

            }

        ))->withoutObjectCaching();

    }
<?php     public function virtualDateTimeWithoutCaching(): Attribute

    {

        return Attribute::get(function () {

            return Date::now()->addSeconds(mt_rand(0, 10000));

        })->withoutObjectCaching();

    }

}
<?php         for ($i = 0; $i < 10; ++$i) {


            $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true).$suffix;
<?php     protected function createPackageMock()

    {

        return $this->getMockBuilder('Composer\Package\Package')

            ->setConstructorArgs(array(md5((string) mt_rand()), '1.0.0.0', '1.0.0'))

            ->getMock();

    }

}
<?php     protected function createPackageMock()

    {

        return $this->getMockBuilder('Composer\Package\Package')

            ->setConstructorArgs(array(md5((string) mt_rand()), '1.0.0.0', '1.0.0'))

            ->getMock();

    }

}
<?php     private function createPackageMock()

    {

        return $this->getMockBuilder('Composer\Package\Package')

            ->setConstructorArgs(array(md5((string) mt_rand()), '1.0.0.0', '1.0.0'))

            ->getMock();

    }

}
<?php     private function createPackageMock()

    {

        return $this->getMockBuilder('Composer\Package\Package')

            ->setConstructorArgs(array(md5((string) mt_rand()), '1.0.0.0', '1.0.0'))

            ->getMock();

    }

}
<?php         $errno = 0;

        $errstr = '';

        for ($i = 0; $i < 20 && $errno !== $enetunreach; ++$i) {

            $address = 'tcp://192.168.' . mt_rand(0, 255) . '.' . mt_rand(1, 254) . ':8123';

            $client = @stream_socket_client($address, $errno, $errstr, 0.1 * $i);

        }

        if ($client || $errno !== $enetunreach) {
<?php     public function getRandomHexColor(): string

    {

        return sprintf('#%06X', mt_rand(0, 0xFFFFFF));

    }
<?php     public function getRandomRgbColor(): array

    {

        return [

            'r' => mt_rand(0, 255),

            'g' => mt_rand(0, 255),

            'b' => mt_rand(0, 255),

        ];
<?php     {

        return [

            'r' => mt_rand(0, 255),

            'g' => mt_rand(0, 255),

            'b' => mt_rand(0, 255),

        ];

    }
<?php         return [

            'r' => mt_rand(0, 255),

            'g' => mt_rand(0, 255),

            'b' => mt_rand(0, 255),

        ];

    }