function generate_key($size)
{
  include_once(PHPWG_ROOT_PATH.'include/random_compat/random.php');

  return substr(
    str_replace(
      array('+', '/'),
      '',
      base64_encode(random_bytes($size+10))
      ),
    0,
    $size
    );
}
The software uses a Pseudo-Random Number Generator (PRNG) but does not correctly manage seeds.