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();

    }

}