public static function genRndTempnam($dir = null, $prefix = 'php')
    {
        if (!$dir) {
            $dir = sys_get_temp_dir();
        }

        static $n = 0;

        return $dir . '/' . $prefix . str_shuffle(
            md5(
                str_shuffle(
                    microtime(true) . chr(mt_rand(0, 0xFF))
                    . Daemon::$process->getPid() . chr(mt_rand(0, 0xFF))
                    . (++$n) . mt_rand(0, mt_getrandmax())
                )
            )
        );
    }