public static function getBytes( $count, $allowWeak = false ) {
		if ( function_exists( 'random_bytes' ) ) {
			$bytes = random_bytes( $count );
			if ( strlen( $bytes ) === $count ) {
				return $bytes;
			}
		}

		if ( function_exists( 'mcrypt_create_iv' ) ) {
			$bytes = mcrypt_create_iv( $count, MCRYPT_DEV_URANDOM );

			if ( strlen( $bytes ) === $count ) {
				return $bytes;
			}
		}

		if ( function_exists( 'openssl_random_pseudo_bytes' ) ) {
			$bytes = openssl_random_pseudo_bytes( $count, $strong );

			if ( $strong && strlen( $bytes ) === $count ) {
				return $bytes;
			}
		}

		if ( is_readable( '/dev/urandom' ) ) {
			// @codingStandardsIgnoreStart : Silencing errors is discouraged
			$fh = @fopen( '/dev/urandom', 'rb' );
			// @codingStandardsIgnoreEnd
			if ( false !== $fh ) {
				$bytes = '';
				$have = 0;
				while ( $have < $count ) {
					$bytes .= fread( $fh, $count - $have );
					$have = strlen( $bytes );
				}
				fclose( $fh );

				if ( strlen( $bytes ) === $count ) {
					return $bytes;
				}
			}
		}

		if ( $allowWeak !== true ) {
			throw new InvalidArgumentException(
				'No high entropy source of random data found and ' .
				'weak sources disallowed in function call'
			);
		}

		// create a high entropy seed value
		$seed = microtime() . uniqid( '', true );
		if ( function_exists( 'getmypid' ) ) {
			$seed .= getmypid();
		}

		$bytes = '';
		for ( $i = 0; $i < $count; $i += 16 ) {
			$seed = md5( microtime() . $seed );
			$bytes .= pack( 'H*', md5( $seed ) );
		}

		return substr( $bytes, 0, $count );
	}