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 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),

        ];

    }