src/Model/Entity/Token.php
public static function random($length = null)
    {
        if ($length === null) {
            $length = Configure::read('Muffin/Tokenize.length', self::DEFAULT_LENGTH);
        }

        return bin2hex(Security::randomBytes($length / 2));
    }
public static function random($length = null)
    {
        if ($length === null) {
            $length = Configure::read('Muffin/Tokenize.length', self::DEFAULT_LENGTH);
        }

        return bin2hex(Security::randomBytes($length / 2));
    }
public static function random ( $ length = null ) { if ( $ length === null ) { $ length = Configure :: read ( 'Muffin/Tokenize.length' , self :: DEFAULT_LENGTH ) ; } return bin2hex ( Security :: randomBytes ( $ length / 2 ) ) ; }
Creates a secure random token.

@param int|null $length Token length
@return string
@see http://stackoverflow.com/a/29137661/2020428
Creates a secure random token .