regen/Generator.hpp
/**
         * generates a random string matching the given regular expression
         * 
         * @param repetition_max max number of repetitions for + and *
         *                       defaults to 5
         * @param repetition_min min number of repetitions for + and *
         *                       defaults to 0.
         *                       + will still be at least 1 repetition.
         * @param restricted_range range of characters that can be generated
         *                         given in regex notation e.g. "[a-zA-Z]"
         */
generates a random string matching the given regular expression

@param repetition_max max number of repetitions for + and
defaults to 5
@param repetition_min min number of repetitions for + and
defaults to 0.
+ will still be at least 1 repetition.
@param restricted_range range of characters that can be generated
given in regex notation e.g.
generates a random string matching the given regular expression @param repetition_max max number of repetitions for + and defaults to 5 @param repetition_min min number of repetitions for + and defaults to 0 . + will still be at least 1 repetition . @param restricted_range range of characters that can be generated given in regex notation e . g .
Generator( std::size_t repetition_max = 5,
            std::size_t repetition_min = 0,
            const std::string& restricted_range = "" )
        : m_rng( std::chrono::high_resolution_clock::now().time_since_epoch().count() ),
        m_repetition_max( repetition_max ),
        m_repetition_min( repetition_min ),
        m_fullSetRegex( "[\\w:!\\?\\-\\+=]" )
        {
            if( repetition_min > repetition_max )
                throw std::logic_error( "minimum repetitions cannot be greater than maximum repetitions" );
            if( repetition_max < 1 )
                repetition_max = 1;
            {
                auto tokens = lexer( m_fullSetRegex );
                auto fullSet = Parser().parseStandAloneSet( tokens );
                m_fullSet = generateChoices( fullSet );
                std::sort( m_fullSet.begin(), m_fullSet.end() );
            }
            if( !restricted_range.empty() )
            {
                auto tokens = lexer(restricted_range);
                auto restrictedSet = Parser().parseStandAloneSet( tokens );
                m_restrictedSet = generateChoices( restrictedSet );
                std::sort( m_restrictedSet.begin(), m_restrictedSet.end() );
            }
        }
Generator ( std :: size_t repetition_max = 5 , std :: size_t repetition_min = 0 , const std :: string & restricted_range = " " ) : m_rng ( std :: chrono :: high_resolution_clock :: now ( ) . time_since_epoch ( ) . count ( ) ) , m_repetition_max ( repetition_max ) , m_repetition_min ( repetition_min ) , m_fullSetRegex ( " \\ \\ \\ \\ " ) { if ( repetition_min > repetition_max ) throw std :: logic_error ( " " ) ; if ( repetition_max < 1 ) repetition_max = 1 ; { auto tokens = lexer ( m_fullSetRegex ) ; auto fullSet = Parser ( ) . parseStandAloneSet ( tokens ) ; m_fullSet = generateChoices ( fullSet ) ; std :: sort ( m_fullSet . begin ( ) , m_fullSet . end ( ) ) ; } if ( ! restricted_range . empty ( ) ) { auto tokens = lexer ( restricted_range ) ; auto restrictedSet = Parser ( ) . parseStandAloneSet ( tokens ) ; m_restrictedSet = generateChoices ( restrictedSet ) ; std :: sort ( m_restrictedSet . begin ( ) , m_restrictedSet . end ( ) ) ; } }
generates a random string matching the given regular expression
generates a random string matching the given regular expression