<commit_before><?php

/**
 * Random.php
 * 
 * PHP version 7
 * 
 * @category Dcrypt
 * @package  Dcrypt
 * @author   <NAME> (mmeyer2k) <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT The MIT License (MIT)
 * @link     https://github.com/mmeyer2k/dcrypt
 * @link     https://apigen.ci/github/mmeyer2k/dcrypt
 */

namespace Dcrypt;

/**
 * Stochastic functions
 *
 * @category Dcrypt
 * @package  Dcrypt
 * @author   <NAME> (mmeyer2k) <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT The MIT License (MIT)
 * @link     https://github.com/mmeyer2k/dcrypt
 * @link     https://apigen.ci/github/mmeyer2k/dcrypt/class-Dcrypt.Random.html
 */
final class Random
{
    /**
     * Return securely generated random bytes.
     * 
     * @param int  $bytes  Number of bytes to get
     * 
     * @return string
     */
    public static function bytes(int $bytes): string
    {        
        return \random_bytes($bytes);
    }    

    /**
     * Deterministic seeded array shuffle function. Does not keep keys.
     *
     * @param array  $array   Array to shuffle
     * @param string $seed    Seed to use 
     * @param bool   $bestrng Whether to use secure RNG in PHP 7.1+. Use false to fall back to broken version for BC.
     *
     * @return array
     */
    public static function shuffle(array $array, string $seed, bool $bestrng = true): array
    {
        $count = \count($array);

        $range = \range(0, $count - 1);

        // Hash the seed and extract bytes to make integer with
        $seed = Str::substr(\hash('sha256', $seed, true), 0, PHP_INT_SIZE);

        // Convert bytes to an int
        $seed = \unpack('L', $seed);

        $fixedRng = \version_compare(PHP_VERSION, '7.1.0') >= 0;<commit_msg>Mark items as deprecated<commit_after><?php

/**
 * Random.php
 * 
 * PHP version 7
 * 
 * @category Dcrypt
 * @package  Dcrypt
 * @author   <NAME> (mmeyer2k) <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT The MIT License (MIT)
 * @link     https://github.com/mmeyer2k/dcrypt
 * @link     https://apigen.ci/github/mmeyer2k/dcrypt
 */

namespace Dcrypt;

/**
 * Stochastic functions
 *
 * @category Dcrypt
 * @package  Dcrypt
 * @author   <NAME> (mmeyer2k) <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT The MIT License (MIT)
 * @link     https://github.com/mmeyer2k/dcrypt
 * @link     https://apigen.ci/github/mmeyer2k/dcrypt/class-Dcrypt.Random.html
 */
final class Random
{
    /**
     * Return securely generated random bytes.
     * 
     * @param int  $bytes  Number of bytes to get
     * 
     * @return string
     * @deprecated
     */
    public static function bytes(int $bytes): string
    {        
        return \random_bytes($bytes);
    }    

    /**
     * Deterministic seeded array shuffle function. Does not keep keys.
     *
     * @param array  $array   Array to shuffle
     * @param string $seed    Seed to use 
     * @param bool   $bestrng Whether to use secure RNG in PHP 7.1+. Use false to fall back to broken version for BC.
     *
     * @return array
     * @deprecated
     */
    public static function shuffle(array $array, string $seed, bool $bestrng = true): array
    {
        $count = \count($array);

        $range = \range(0, $count - 1);

        // Hash the seed and extract bytes to make integer with
        $seed = Str::substr(\hash('sha256', $seed, true), 0, PHP_INT_SIZE);

        // Convert bytes to an int
        $seed = \unpack('L', $seed);

        $fixedRng = \version_compare(PHP_VERSION, '7.1.0') >= 0;
{'fraction_non_alphanumeric': 0.13170593244393983, 'fraction_numerical': 0.010786261708770934, 'mean_word_length': 2.356190476190476, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '863195', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1126, 'n_words': 324}