Generate heroku-like random names

@return String
962980
public String haikunate() {
        if (tokenHex) {
            tokenChars = "0123456789abcdef";
        }

        String adjective = randomString(adjectives);
        String noun = randomString(nouns);

        StringBuilder token = new StringBuilder();
        if (tokenChars != null && tokenChars.length() > 0) {
            for (int i = 0; i < tokenLength; i++) {
                token.append(tokenChars.charAt(random.nextInt(tokenChars.length())));
            }
        }

        return Stream.of(adjective, noun, token.toString())
                .filter(s -> s != null && !s.isEmpty())
                .collect(joining(delimiter));
    }
1200282
private function generateUUID()
    {
        return sprintf(
            '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0x0fff) | 0x4000,
            mt_rand(0, 0x3fff) | 0x8000,
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff)
        );
    }
372157
protected function generateBasename()
    {
        $filename = md5($this->image . $this->height . $this->width);

        if (isset(static::$config['default_extension'])) {

            $extension = static::$config['default_extension'];

        } else {

            $extension = pathinfo($this->image, PATHINFO_EXTENSION);

        }

        return $filename . '.' . $extension;   
    }
713443
public function generateNewUuid(): string
    {
        $uuid = (string) Uuid::generate(4);

        return $this->uuidPrefix . str_replace('-', '', $uuid);
    }
351550
public function getUniqueFolderName()
    {
        return sprintf(
            '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
            mt_rand(0, 65535),
            mt_rand(0, 65535),
            mt_rand(0, 65535),
            mt_rand(0, 4095) | 0x4000,
            mt_rand(0, 0x3fff) | 0x8000,
            mt_rand(0, 65535),
            mt_rand(0, 65535),
            mt_rand(0, 65535)
        );
    }
686401
public function generateHrefLangsTags()
    {
        $render = '';
        $urls = $this->currentRequestAllUrls();

        foreach ($urls as $language => $url) {
            $render .= '<link rel="alternate" href="' .$url. '" hreflang="' .$language. '"/>'."\n";
        }

        return $render;
    }
529522
private function _generateAlphaToken()
    {
        $timestamp = strtotime($this->_generateTimestamp());
        $characters = str_split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
        shuffle($characters);
        $randomString = '';
        foreach (str_split((string) $timestamp) as $num) {
            $randomString .= $characters[$num];
        }
        return $randomString;
    }
323215
def get_random_name():
    """"""
    char_seq = []
    name_source = random.randint(1, 2**8-1)
    current_value = name_source
    while current_value > 0:
        char_offset = current_value % 26
        current_value = current_value - random.randint(1, 26)
        char_seq.append(chr(char_offset + ord('a')))
    name = ''.join(char_seq)
    assert re.match(VALID_PACKAGE_RE, name)
    return name
1309779
protected function randomLetters()
    {
        for ($i = 0; $i < $this->length; $i++)
        {
            $letters     = $this->letters[mt_rand(0, count($this->letters) - 1)];
            $this->code .= $letters[mt_rand(0, strlen($letters) - 1)];
        }
    }
1226165
private function generateFromGeneric()
    {
        $ctypes = $this->app['config']->get('contenttypes');

        $translatables = array_filter(
            array_keys($this->translatables),
            function ($key) {
                return substr($key, 0, 21) === 'contenttypes.generic.' && substr($key, 21, 6) !== 'group.';
            }
        );

        foreach ($translatables as $key) {
            foreach ($ctypes as $ctname => $ctype) {
                $setkey = 'contenttypes.' . $ctname . '.text.' . substr($key, 21);
                $this->translation[$setkey] = isset($this->saved[$setkey]) ? $this->saved[$setkey] : '';
                if ($this->translation[$setkey] === '') {
                    $generic = Trans::__($key);
                    // If not translated, add hint
                    if ($generic !== $key) {
                        $replacement = [];
                        if (strpos($generic, '%contenttypes%') !== false) {
                            $replacement['%contenttypes%'] = $ctname;
                        } elseif (strpos($generic, '%contenttype%') !== false) {
                            $replacement['%contenttype%'] = $ctname;
                        }
                        $this->hints[$setkey] = Trans::__($key, $replacement);
                    }
                }
            }
        }
    }
1103291
private function generateFilename()
    {
        $filename = str_random(100) . "." . $this->extension;

        if(Storage::exists($this->folder . '/' . $filename))
        {
            $this->generateFilename();
        }

        return $filename;
    }
510733
public function generateFilename()
    {
        $filename = $this->label().' '.date('Y-m-d H-i-s');
        $extension = $this->generateExtension();

        if ($extension) {
            return $filename.'.'.$extension;
        } else {
            return $filename;
        }
    }
214106
protected function generatePartials()
    {
        $partials = $this->handlebars->getPartials();
        
        foreach ($partials as $name => $partial) {
            $partials[$name] = sprintf(
                self::BLOCK_OPTIONS_HASH_KEY_VALUE,
                $name,
                "'" . str_replace("'", '\\\'', $partial) . "'"
            );
        }
        
        return $this->prettyPrint(self::BLOCK_OPTIONS_OPEN)
            . $this->prettyPrint('\r\t')
            . implode($this->prettyPrint(',\r\t'), $partials)
            . $this->prettyPrint(self::BLOCK_OPTIONS_CLOSE);
    }
1349891
protected function _generateBasedOnMtRand()
    {
        return sprintf(
            '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0x0fff) | 0x4000,
            mt_rand(0, 0x3fff) | 0x8000,
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0xffff)
        );
    }
828848
private function names()
    {
        $fileName = date("Y_m_d_His") . '_create_';
        $fileName .= str_replace(' ', '_', $this->name);
        $fileName       = strtolower($fileName) . '_table.php';
        $this->fileName = $fileName;

        $className       = 'Create' . ' ' . $this->name . ' Table';
        $className       = Str::camel($className);
        $this->className = ucfirst($className);
    }
770515
public function ___build(): string
    {
        $tables = \implode(', ', $this->tables);
        $fields = \implode(', ', $this->fields);
        $where = $orderBy = $limit = '';

        if ($this->where != '') {
            $where = \sprintf(' WHERE %s', $this->where);
        }
        if (\count($this->orderBy) > 0) {
            $orderBy = \sprintf(' ORDER BY %s', \implode(', ', $this->orderBy));
        }
        if ($this->limit != 0) {
            $limit = \sprintf(' LIMIT %s', $this->limit);
        }

        return \sprintf('UPDATE %s SET %s%s%s%s', $tables, $fields, $where, $orderBy, $limit);
    }
1125095
public static function randomString()
  {
    if ( version_compare(PHP_VERSION,'7.0.0', '<') ){
      return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
        // 32 bits for "time_low"
        mt_rand(0, 0xffff), mt_rand(0, 0xffff),
        // 16 bits for "time_mid"
        mt_rand(0, 0xffff),
        // 16 bits for "time_hi_and_version",
        // four most significant bits holds version number 4
        mt_rand(0, 0x0fff) | 0x4000,
        // 16 bits, 8 bits for "clk_seq_hi_res",
        // 8 bits for "clk_seq_low",
        // two most significant bits holds zero and one for variant DCE1.1
        mt_rand(0, 0x3fff) | 0x8000,
        // 48 bits for "node"
        mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
      );
    }
    else {
      return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
        // 32 bits for "time_low"
        random_int(0, 0xffff), random_int(0, 0xffff),
        // 16 bits for "time_mid"
        random_int(0, 0xffff),
        // 16 bits for "time_hi_and_version",
        // four most significant bits holds version number 4
        random_int(0, 0x0fff) | 0x4000,
        // 16 bits, 8 bits for "clk_seq_hi_res",
        // 8 bits for "clk_seq_low",
        // two most significant bits holds zero and one for variant DCE1.1
        random_int(0, 0x3fff) | 0x8000,
        // 48 bits for "node"
        random_int(0, 0xffff), random_int(0, 0xffff), random_int(0, 0xffff)
      );
    }
  }