<commit_before>#pragma once

#include <random>
#include <type_traits>

namespace ncv
{
        ///
        /// uniform random number generator in the [min, max] range.
        ///
        template
        <
                typename tscalar
        >
        class random_t
        {
        public:
                
                // constructor
                random_t(tscalar min, tscalar max)
                        :       m_gen(),//std::random_device()),
                                m_die(std::min(min, max),
                                      std::max(min, max))
                {
                        std::random_device rd;
                        m_gen = gen_t(rd());
                }
                
                // generate a random value
                tscalar operator()()
                {
                        return m_die(m_gen);
                }
                
                // fill the [begin, end) range with random values
                template
                <
                        class titerator
                >
                void operator()(titerator begin, titerator end)
                {
                        for (; begin != end; ++ begin)
                        {
                                *begin = operator()();
                        }
                }

                // access functions
                tscalar min() const { return m_die.min(); }
                tscalar max() const { return m_die.max(); }
                
        private:

                typedef std::mt19937                                    gen_t;

                typedef typename std::conditional
                <
                        std::is_arithmetic<tscalar>::value &&
                        std::is_integral<tscalar>::value,
                        std::uniform_int_distribution<tscalar>,
                        std::uniform_real_distribution<tscalar>
                >::type                                                 die_t;

                // attributes
                gen_t           m_gen;
                die_t           m_die;
        };
}<commit_msg>random index<commit_after>#pragma once

#include <random>
#include <type_traits>

namespace ncv
{
        ///
        /// uniform random number generator in the [min, max] range.
        ///
        template
        <
                typename tscalar
        >
        class random_t
        {
        public:
                
                // constructor
                random_t(tscalar min, tscalar max)
                        :       m_gen(),//std::random_device()),
                                m_die(std::min(min, max),
                                      std::max(min, max))
                {
                        std::random_device rd;
                        m_gen = gen_t(rd());
                }
                
                // generate a random value
                tscalar operator()()
                {
                        return m_die(m_gen);
                }
                
                // fill the [begin, end) range with random values
                template
                <
                        class titerator
                >
                void operator()(titerator begin, titerator end)
                {
                        for (; begin != end; ++ begin)
                        {
                                *begin = operator()();
                        }
                }

                // access functions
                tscalar min() const { return m_die.min(); }
                tscalar max() const { return m_die.max(); }
                
        private:

                typedef std::mt19937                                    gen_t;

                typedef typename std::conditional
                <
                        std::is_arithmetic<tscalar>::value &&
                        std::is_integral<tscalar>::value,
                        std::uniform_int_distribution<tscalar>,
                        std::uniform_real_distribution<tscalar>
                >::type                                                 die_t;

                // attributes
                gen_t           m_gen;
                die_t           m_die;
        };

        ///
        /// generate random indices (e.g. for std::random_shuffle)
        ///
        template
        <
                typename tsize
        >
        struct random_index_t
        {
                random_index_t(random_t<tsize>& gen)
                        :       m_gen(gen)
                {
                }

                tsize operator()(tsize size)
                {
                        return m_gen() % size;
                }

                random_t<tsize>&  m_gen;
        };
}
{'fraction_non_alphanumeric': 0.08083769633507853, 'fraction_numerical': 0.0020942408376963353, 'mean_word_length': 0.7229437229437229, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7281649', 'n_tokens_mistral': 1133, 'n_tokens_neox': 999, 'n_words': 217}