Что за это код? :D

// random TR1 header
#pragma once
#ifndef _RANDOM_
#define _RANDOM_
#ifndef RC_INVOKED
#include <istream>
#include <vector>

 #pragma pack(push,_CRT_PACKING)
 #pragma warning(push,3)
 #pragma push_macro("new")
 #undef new

 #pragma warning(disable: 4127 4244 4296 4389 4521 4723)

  #pragma warning(disable: 6294 6326)

 #ifndef _BITS_BYTE
  #define _BITS_BYTE    8
 #endif /* _BITS_BYTE */

 #if defined(_DEBUG) || defined(_RNG_CHECK)
  #define _RNG_ASSERT(ex, msg)  \
    ((ex) ? (void)0 : _Rng_abort(__FILE__ "(" _STRINGIZE(__LINE__) "): " msg))

 #else /* defined(_DEBUG) || defined(_RNG_CHECK) */
  #define _RNG_ASSERT(ex, msg) ((void)0)
 #endif /* defined(_DEBUG) || defined(_RNG_CHECK) */

_STD_BEGIN
    // TEMPLATE STRUCT _Is_RealType
template<class _Ty>
    struct _Is_RealType
        : _Cat_base<is_same<_Ty, float>::value
        || is_same<_Ty, double>::value
        || is_same<_Ty, long double>::value>
    {   // determine whether _Ty satisfies <random>'s RealType requirements
    };

    // TEMPLATE STRUCT _Is_UIntType
template<class _Ty>
    struct _Is_UIntType
        : _Cat_base<is_same<_Ty, unsigned short>::value
        || is_same<_Ty, unsigned int>::value
        || is_same<_Ty, unsigned long>::value
        || is_same<_Ty, unsigned long long>::value>
    {   // determine whether _Ty satisfies <random>'s UIntType requirements
    };

    // TEMPLATE STRUCT _Is_IntType
template<class _Ty>
    struct _Is_IntType
        : _Cat_base<is_same<_Ty, short>::value
        || is_same<_Ty, int>::value
        || is_same<_Ty, long>::value
        || is_same<_Ty, long long>::value
        || _Is_UIntType<_Ty>::value>
    {   // determine whether _Ty satisfies <random>'s IntType requirements
    };

    // CONSTANTS
static const long double _Pi = 3.14159265358979323846264338327950288L;
static const long double _Exp1 = 2.71828182845904523536028747135266250L;
static const long double _Two32 = 4294967296.0L;
static const long double _Two31 = 2147483648.0L;

    // HELPER FUNCTIONS
_CRTIMP2_PURE _NO_RETURN(__CLRCALL_PURE_OR_CDECL _Rng_abort(_In_z_ const char *_Msg));
_CRTIMP2_PURE float __CLRCALL_PURE_OR_CDECL _XLgamma(float);
_CRTIMP2_PURE double __CLRCALL_PURE_OR_CDECL _XLgamma(double);
_CRTIMP2_PURE long double __CLRCALL_PURE_OR_CDECL _XLgamma(long double);

    // TEMPLATE FUNCTION _Nrand
#define _NRAND(eng, resty)  _Nrand(eng, (eng.min)(), (resty)1)

template<class _Engine,
    class _Ety,
    class _Rty>
    _Rty _Nrand(_Engine& _Eng, _Ety _Emin, _Rty _Inc)
    {   // scale random value to [0, 1), integer engine
    return ((_Eng() - _Emin)
        / ((_Rty)(_Eng.max)() - (_Rty)_Emin + _Inc));
    }

template<class _Engine,
    class _Rty>
    _Rty _Nrand(_Engine& _Eng, float _Emin, _Rty)
    {   // scale random value to [0, 1), float engine
    return ((_Eng() - _Emin) / ((_Eng.max)() - _Emin));
    }

template<class _Engine,
    class _Rty>
    _Rty _Nrand(_Engine& _Eng, double _Emin, _Rty)
    {   // scale random value to [0, 1), double engine
    return ((_Eng() - _Emin) / ((_Eng.max)() - _Emin));
    }

template<class _Engine,
    class _Rty>
    _Rty _Nrand(_Engine& _Eng, long double _Emin, _Rty)
    {   // scale random value to [0, 1), long double engine
    return ((_Eng() - _Emin) / ((_Eng.max)() - _Emin));
    }

    // I/O HELPERS FOR FLOATING-POINT VALUES
static const int _Nwords = 4;

template<class _Elem,
    class _Traits>
    basic_ostream<_Elem, _Traits>& _Write(
        basic_ostream<_Elem, _Traits>& _Os, long double _Dx)
    {   // write long double to stream
    int _Ex;
    long double _Frac = _CSTD frexpl(_Dx, &_Ex);
    for (int _Nw = 0; _Nw < _Nwords; ++_Nw)
        {   // break into 31-bit words
        _Frac *= _Two31;
        long _Digits = (long)_Frac;
        _Frac -= _Digits;
        _Os << ' ' << _Digits;
        }
    _Os << ' ' << _Ex;
    return (_Os);
    }

template<class _Elem,
    class _Traits>
    basic_istream<_Elem, _Traits>&
        _Read(basic_istream<_Elem, _Traits>& _Is, long double& _Dx)
    {   // read long double from stream
    long double _Frac = 0.0;
    long _Digits;
    for (int _Nw = 0; _Nw < _Nwords; ++_Nw)
        {   // accumulate 31-bit words
        _Is >> _Digits;
        long double _Temp = _Digits / _Two31;
        for (int _Idx = 0; _Idx < _Nw; ++_Idx)
            _Temp /= _Two31;
        _Frac += _Temp;
        }
    _Is >> _Digits;
    _Dx = _CSTD ldexpl(_Frac, _Digits);
    return (_Is);
    }

template<class _Elem,
    class _Traits,
    class _Ty>
    basic_istream<_Elem, _Traits>&
        _In(basic_istream<_Elem, _Traits>& _Is, _Ty& _Dx)
    {   // read from stream
    long double _Vx;
    _Ty _Max = (numeric_limits<_Ty>::max)();
    _Read(_Is, _Vx);
    if (_CSTD fabsl(_Vx) <= _Max)
        _Dx = (_Ty)_Vx;
    else if (_Vx < 0)
        _Dx = -_Max;
    else
        _Dx = _Max;
    return (_Is);
    }

template<class _Elem,
    class _Traits,
    class _Ty>
    basic_ostream<_Elem, _Traits>&
        _Out(basic_ostream<_Elem, _Traits>& _Os, _Ty _Dx)
    {   // write to stream
    return (_Write(_Os, _Dx));
    }

template<class _Elem,
    class _Traits,
    class _Ty>
    class _Wrap_istream
    {   // wrap input stream as function object
public:
    _Wrap_istream(basic_istream<_Elem, _Traits>& _Is)
        : _Str(_Is)
        {   // construct
        }

    _Ty operator()()
        {   // read next value
        _Ty _Data;
        _Str >> _Data;
        if (!_Str)
            _Xinvalid_argument("input stream corrupted");
        return (_Data);
        }

    _Wrap_istream& operator=(const _Wrap_istream&) = delete;

private:
    basic_istream<_Elem, _Traits>& _Str;
    };

    // CLASS seed_seq
class seed_seq
    {   // standard sequence of seed values
public:
    typedef unsigned int result_type;

    seed_seq()
        {   // default constructor
        }

    template<class _Ty>
        seed_seq(_XSTD initializer_list<_Ty> _Ilist)
        {   // construct from [_First, _Last)
        _Construct(_Ilist.begin(), _Ilist.end(), (_Ty *)0);
        }

    template<class _InIt>
        seed_seq(_InIt _First, _InIt _Last)
        {   // construct from [_First, _Last)
        _Construct(_First, _Last, _Val_type(_First));
        }

    template<class _RanIt>
        void generate(_RanIt _First, _RanIt _Last) const
        {   // generate randomized interval from seeds
        _Generate(_First, _Last, _Val_type(_First));
        }

    template<class _OutIt>
        void param(_OutIt _Dest) const
        {   // copy seeds
        copy(_Myvec.begin(), _Myvec.end(), _Dest);
        }

    size_t size() const
        {   // get size of seed
        return (_Myvec.size());
        }

    seed_seq(const seed_seq&) = delete;
    void operator=(const seed_seq&) = delete;

private:
    template<class _InIt,
        class _Ty>
        void _Construct(_InIt _First, _InIt _Last, _Ty *)
        {   // construct from [_First, _Last)
        for (; _First != _Last; ++_First)
            _Myvec.push_back((unsigned int)*_First);
        }

    template<class _RanIt,
        class _Ty>
        void _Generate(_RanIt _First, _RanIt _Last, _Ty *) const
        {   // generate randomized interval from seeds
        const size_t _Nx = _Last - _First;

        if (0 < _Nx)
            {   // finite interval, fill it
            const size_t _Sx = _Myvec.size();
            const size_t _Tx = 623 <= _Nx ? 11 : 68 <= _Nx ? 7
                : 39 <= _Nx ? 5 : 7 <= _Nx ? 3 : (_Nx - 1) / 2;
            const size_t _Px = (_Nx - _Tx) / 2;
            const size_t _Qx = _Px + _Tx;
            const size_t _Mx = _Nx <= _Sx ? _Sx + 1 : _Nx;
            size_t _Kx;

            _Ty _Mask = _Ty(1) << 31;
            _Mask <<= 1;    // build 32-bit mask safely
            _Mask -= 1;

            for (_Kx = 0; _Kx < _Nx; ++_Kx)
                _First[_Kx] = 0x8b8b8b8b;
            for (_Kx = 0; _Kx < _Mx; ++_Kx)
                {   // scramble and add any vector contributions
                result_type _R1 = 1664525 * _Xor27(_First[_Kx % _Nx]
                    ^ _First[(_Kx + _Px) % _Nx] ^ _First[(_Kx - 1) % _Nx]);
                result_type _R2 = (result_type)((_R1 + (_Kx == 0 ? _Sx
                    : _Kx <= _Sx ? _Kx % _Nx + _Myvec[(_Kx - 1) % _Sx]
                    : _Kx % _Nx)) & _Mask);

                _First[(_Kx + _Px) % _Nx] =
                    (_First[(_Kx + _Px) % _Nx] + _R1) & _Mask;
                _First[(_Kx + _Qx) % _Nx] =
                    (_First[(_Kx + _Qx) % _Nx] + _R2) & _Mask;
                _First[_Kx % _Nx] = _R2;
                }
            for (; _Kx < _Mx + _Nx; ++_Kx)
                {   // rescramble
                result_type _R3 = 1566083941 * _Xor27(_First[_Kx % _Nx]
                    + _First[(_Kx + _Px) % _Nx] + _First[(_Kx - 1) % _Nx]);
                result_type _R4 = (result_type)((_R3 - _Kx % _Nx) & _Mask);

                _First[(_Kx + _Px) % _Nx] =
                    (_First[(_Kx + _Px) % _Nx] ^ _R3) & _Mask;
                _First[(_Kx + _Qx) % _Nx] =
                    (_First[(_Kx + _Qx) % _Nx] ^ _R4) & _Mask;
                _First[_Kx % _Nx] = _R4;
                }
            }
        }

    result_type _Xor27(result_type _Val) const
        {   // shift and merge
        return (_Val ^ (_Val >> 27));
        }

    vector<result_type> _Myvec;
    };

    // TEMPLATE FUNCTION generate_canonical
template<class _Real,
    size_t _Bits,
    class _Gen>
    _Real generate_canonical(_Gen& _Gx)
    {   // build a floating-point value from random sequence
    static_assert(_Is_RealType<_Real>::value,
        "invalid template argument for generate_canonical");

    int _Minbits = _Bits < 1 ? 1 : _Bits;
    if (numeric_limits<_Real>::digits < _Minbits)
        _Minbits = numeric_limits<_Real>::digits;

    _Real _Gxmin = (_Real)(_Gx.min)();
    _Real _Ans = (_Real)_Gx() - _Gxmin;
    _Real _Base = (_Real)(_Gx.max)() + (_Real)1 - _Gxmin;
    double _Basen = _CSTD ldexp(1.0, _Minbits);

    for (; 1.0 < _Basen; _Basen /= _Base)
        _Ans = _Ans * _Base + (_Real)_Gx() - _Gxmin;
    return (_Ans);
    }

    // MULTIPLE PRECISION MATH FUNCTIONS

#ifdef _ULONGLONG
typedef _ULONGLONG _Max_type;

#else /* _ULONGLONG */
typedef unsigned long _Max_type;
#endif /* _ULONGLONG */

static const int _MP_len = 5;
typedef _Max_type _MP_arr[_MP_len];

_CRTIMP2_PURE _Max_type __CLRCALL_PURE_OR_CDECL _MP_Get(_MP_arr);
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _MP_Add(_MP_arr, _Max_type);
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _MP_Mul(_MP_arr, _Max_type, _Max_type);
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _MP_Rem(_MP_arr, _Max_type);

    // TEMPLATE CLASS linear_congruential
template<class _Ity,
    class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx>
    struct _Mul_mod
    {   // template class for linear congruential generator where
        // _Ty is large enough to hold intermediate result without overflow
    _Mul_mod(_Ty _Val = 0)
        : _Prev(_Val)
        {   // construct
        }

    _Ty operator()()
        {   // return next value
        static _Ty _Zero = 0;   // to quiet diagnostics
        _Ty _Divisor = (_Ty)_Mx;

        _Prev = _Mx ? ((_Ity)_Ax * _Prev + (_Ty)_Cx) % _Divisor
            : ((_Ity)_Ax * _Prev + (_Ty)_Cx);
        if (_Prev < _Zero)
            _Prev += (_Ty)_Mx;
        return (_Prev);
        }

    _Ty _Prev;
    };

template<class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx>
    class _Mult_prec
    {   // template class for linear congruential generator using
        // multiple precision arithmetic to avoid overflows
public:
    _Mult_prec(_Ty _Val = 0)
        : _Prev(_Val)
        {   // construct
        }

    _Ty operator()()
        {   // return next value
        _MP_arr _Wx;
        _MP_Mul(_Wx, _Prev, _Ax);
        _MP_Add(_Wx, _Cx);
        _MP_Rem(_Wx, _Mx);
        _Prev = _MP_Get(_Wx);
        return (_Prev);
        }

    _Ty _Prev;
    };

#ifdef _ULONGLONG
template<class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx,
    bool>
    struct _Select_ulonglong
    {   // unsigned long long too small, use multiple precision
    typedef _Mult_prec<_Ty, _Ax, _Cx, _Mx> type;
    };

template<class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx>
    struct _Select_ulonglong<_Ty, _Ax, _Cx, _Mx, true>
    {   // unsigned long long can hold intermediate result
    typedef _Mul_mod<_ULONGLONG, _Ty, _Ax, _Cx, _Mx> type;
    };

template<class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx,
    bool>
    struct _Select_ulong
    {   // unsigned long too small, try unsigned long long
    typedef typename _Select_ulonglong<_Ty, _Ax, _Cx, _Mx,
        _Cx < _ULLONG_MAX && _Mx <= (_ULLONG_MAX - _Cx) / _Ax>::type type;
    };

#else /* _ULONGLONG */
template<class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx,
    bool>
    struct _Select_ulong
    {   // unsigned long too small, use multiple precision
    typedef _Mult_prec<_Ty, _Ax, _Cx, _Mx> type;
    };
#endif /* _ULONGLONG */

template<class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx>
    struct _Select_ulong<_Ty, _Ax, _Cx, _Mx, true>
    {   // unsigned long can hold intermediate result
    typedef _Mul_mod<unsigned long, _Ty, _Ax, _Cx, _Mx> type;
    };

template<class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx,
    bool>
    struct _Select_uint
    {   // unsigned int too small, try unsigned long
    typedef typename _Select_ulong<_Ty, _Ax, _Cx, _Mx,
        _Cx < ULONG_MAX && _Mx <= (ULONG_MAX - _Cx) / _Ax>::type type;
    };

template<class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx>
    struct _Select_uint<_Ty, _Ax, _Cx, _Mx, true>
    {   // unsigned int can hold intermediate result
    typedef _Mul_mod<unsigned int, _Ty, _Ax, _Cx, _Mx> type;
    };

template<class _Ty,
    _Max_type _Ax,
    _Max_type _Cx,
    _Max_type _Mx>
    struct _Select
    {   // select a type large enough to hold intermediate result
    typedef typename _Select_uint<_Ty, _Ax, _Cx, _Mx,
        _Cx < UINT_MAX && _Mx <= (UINT_MAX - _Cx) / _Ax>::type type;
    };

template<class _Uint,
    _Uint _Ax,
    _Uint _Cx,
    _Uint _Mx>
    class linear_congruential
    {   // template class to implement linear congruential generator
public:
    typedef linear_congruential<_Uint, _Ax, _Cx, _Mx> _Myt;
    typedef _Uint result_type;

    static const _Uint multiplier = _Ax;
    static const _Uint increment = _Cx;
    static const _Uint modulus = _Mx;

    static const _Uint default_seed = 1U;

    explicit linear_congruential(_Uint _X0 = default_seed)
        {   // construct from initial value
        seed(_X0);
        }

    linear_congruential(const linear_congruential& _Right)
        {   // construct by copying
        *this = _Right;
        }

    linear_congruential(linear_congruential& _Right)
        {   // construct by copying
        *this = _Right;
        }

    template<class _Gen>
        linear_congruential(_Gen& _Gx)
        {   // construct from generator
        seed(_Gx);
        }

    void seed(_Uint _X0 = default_seed)
        {   // reset sequence from numeric value
        _Reset(_X0);
        }

    template<class _Gen>
        void seed(_Gen& _Gx, bool = false)
        {   // reset sequence from generator
        _Seed(_Gx, _Is_numeric<_Gen>());
        }

    _Uint (min)() const
        {   // return minimum possible generated value
        return (_Cx != 0 ? 0 : 1);
        }

    _Uint (max)() const
        {   // return maximum possible generated value
        return (_Mx != 0 ? _Mx - 1 : (numeric_limits<_Uint>::max)());
        }

    _Uint operator()()
        {   // return next value
        return (_Imp());
        }

    void discard(unsigned long long _Nskip)
        {   // discard _Nskip elements
        for (; 0 < _Nskip; --_Nskip)
            (*this)();
        }

    bool _Equals(const _Myt& _Right) const
        {   // return true if *this will generate same sequence as _Right
        return (_Imp._Prev == _Right._Imp._Prev);
        }

    template<class _Elem, class _Traits>
        basic_ostream<_Elem, _Traits>&
            _Write(basic_ostream<_Elem, _Traits>& _Ostr) const
        {   // write state to _Ostr
        return (_Ostr << _Imp._Prev);
        }

protected:
    template<class _Gen>
        void _Seed(_Gen& _Gx, const true_type&)
        {   // reset sequence from numeric value
        _Reset((_Uint)_Gx);
        }

    template<class _Gen>
        void _Seed(_Gen& _Gx, const false_type&)
        {   // reset sequence from generator
        _Reset(_Gx());
        }

    void _Reset(_Uint _X0)
        {   // reset sequence
        _Uint _Divisor = _Mx;   // to quiet diagnostics

        _Imp._Prev = _Mx != 0 ? _X0 % _Divisor : _X0;
        if (_Imp._Prev == 0 && _Cx == 0)
            _Imp._Prev = 1;
        }

    typename _Select<_Uint, _Ax, _Cx, _Mx>::type _Imp;
    };

template<class _Uint,
    _Uint _Ax,
    _Uint _Cx,
    _Uint _Mx>
    bool operator==(
        const linear_congruential<_Uint, _Ax, _Cx, _Mx>& _Left,
        const linear_congruential<_Uint, _Ax, _Cx, _Mx>& _Right)
    {   // return true if _Left will generate same sequence as _Right
    return (_Left._Equals(_Right));
    }

template<class _Uint,
    _Uint _Ax,
    _Uint _Cx,
    _Uint _Mx>
    bool operator!=(
        const linear_congruential<_Uint, _Ax, _Cx, _Mx>& _Left,
        const linear_congruential<_Uint, _Ax, _Cx, _Mx>& _Right)
    {   // return true if *this will not generate same sequence as _Right
    return (!_Left._Equals(_Right));
    }

template<class _Elem,
    class _Traits,
    class _Uint,
    _Uint _Ax,
    _Uint _Cx,
    _Uint _Mx>
    basic_istream<_Elem, _Traits>& operator>>(
        basic_istream<_Elem, _Traits>& _Istr,
        linear_congruential<_Uint, _Ax, _Cx, _Mx>& _Eng)
    {   // read state from _Istr
    _Wrap_istream<_Elem, _Traits, _Uint> _In(_Istr);
    _Eng.seed(_In);
    return (_Istr);
    }

template<class _Elem,
    class _Traits,
    class _Uint,
    _Uint _Ax,
    _Uint _Cx,
    _Uint _Mx>
    basic_ostream<_Elem, _Traits>& operator<<(
        basic_ostream<_Elem, _Traits>& _Ostr,
        const linear_congruential<_Uint, _Ax, _Cx, _Mx>& _Eng)
    {   // write state to _Ostr
    return (_Eng._Write(_Ostr));
    }

        // TEMPLATE CLASS linear_congruential_engine
template<class _Uint,
    _Uint _Ax,
    _Uint _Cx,
    _Uint _Mx>
    class linear_congruential_engine
        : public linear_congruential<_Uint, _Ax, _Cx, _Mx>
    {   // template class to implement linear congruential generator
public:
    static_assert(_Is_UIntType<_Uint>::value
        && (0 == _Mx || (_Ax < _Mx && _Cx < _Mx)),
        "invalid template argument for linear_congruential_engine");

    typedef linear_congruential_engine<_Uint, _Ax, _Cx, _Mx> _Myt;
    typedef linear_congruential<_Uint, _Ax, _Cx, _Mx> _Mybase;

    explicit linear_congruential_engine(_Uint _X0 = _Mybase::default_seed)
        : _Mybase(_X0)
        {   // construct from initial value
        }

    linear_congruential_engine(const _Myt& _Right)
        {   // construct by copying
        *this = _Right;
        }

    linear_congruential_engine(_Myt& _Right)
        {   // construct by copying
        *this = _Right;
        }

    template<class _Seed_seq,
        class = typename enable_if<
            !is_convertible<_Seed_seq, _Uint>::value,
            void>:: type>
        explicit linear_congruential_engine(_Seed_seq& _Seq)
        {   // construct from seed sequence
        seed(_Seq);
        }

    void seed(_Uint _X0 = _Mybase::default_seed)
        {   // reset sequence from numeric value
        this->_Reset(_X0);
        }

    static const int _Nw = (_BITS_BYTE * sizeof (_Uint) + 31) / 32;

    template<class _Seed_seq>
        typename enable_if<
            !is_convertible<_Seed_seq, _Uint>::value,
            void>::type
        seed(_Seed_seq& _Seq)
        {   // reset sequence from seed sequence
        _Uint _Arr[3 + _Nw];
        int _Lsh = _BITS_BYTE * sizeof (_Uint); // to quiet diagnostics

        _Seq.generate(&_Arr[0], &_Arr[3 + _Nw]);
        for (int _Idx = _Nw; 0 < --_Idx; )
            _Arr[3 + _Idx - 1] |=
                _Arr[3 + _Idx] << _Lsh;
        this->_Reset(_Arr[3]);
        }

    static _Uint (min)()
        {   // return minimum possible generated value
        return (_Cx != 0 ? 0 : 1);
        }

    static _Uint (max)()
        {   // return maximum possible generated value
        return (_Mx != 0 ? _Mx - 1 : (numeric_limits<_Uint>::max)());
        }
    };

    // TEMPLATE CLASS _Circ_buf FOR subtract_with_carry,
    //  subtract_with_carry_01, and mersenne_twister
template<class _Ty,
    size_t _Nw>
    struct _Circ_buf
    {   // template class to hold historical values for generators
    _Ty _At(int _Ix) const
        {   // return value at current position plus _Ix
        return (_Ax[_Base(_Ix)]);
        }

    bool _Equals(const _Circ_buf& _Right) const
        {   // return true if *this holds same values as _Right
        const _Ty *_Last1 = _Ax + _Idx;
        const _Ty *_Last2 = _Right._Ax + _Right._Idx;
        const _Ty *_First, *_Last, *_Other;
        bool _Use2 = _Base() < _Right._Base();

        if (_Use2)
            {   // _Right's range is higher up in the array
                // than ours, so scan it first
            _First = _Right._Ax + _Right._Base();
            _Last = _Last2;
            _Other = _Ax + _Base();
            }
        else
            {   // our range is higher up in the array
                // than _Right's, so scan ours first
            _First = _Ax + _Base();
            _Last = _Last1;
            _Other = _Right._Ax + _Right._Base();
            }

        ptrdiff_t _N0 = _Nw;
        while (0 < _N0)
            {   // scan
                // note: may need up to three passes; each scan starts at the
                // current highest array position and ends at the end of the
                // array or the _Idx value, whichever comes first; the
                // equality test succeeds only by reaching the _Idx value.
            const _Ty *_Limit = _First < _Last ? _Last
                : _Use2 ? _Right._Ax + 2 * _Nw
                : _Ax + 2 * _Nw;
            _N0 -= _Limit - _First;
            while (_First != _Limit)
                if (*_First++ != *_Other++)
                    return (false);
            _First = _Other;
            _Last = _Use2 ? _Last1 : _Last2;
            _Other = _Use2 ? _Right._Ax : _Ax;
            _Use2 = !_Use2;
            }
        return (true);
        }

    unsigned int _Base(int _Ix = 0) const
        {   // return _Ix'th historical element (loosely, (_Idx - _Nw) + _Ix)
        return ((_Ix += _Idx) < _Nw ? (_Ix + _Nw) : (_Ix - _Nw));
        }

    unsigned int _Idx;
    _Ty _Ax[2 * _Nw];
    };

    // TEMPLATE CLASS _Swc_base (subtract_with_carry, subtract_with_carry_01)
template<class _Ty,
    size_t _Sx,
    size_t _Rx,
    class _Swc_Traits>
    class _Swc_base
        : public _Circ_buf<_Ty, _Rx>
    {   // base template class for subtract_with_carry/_01
public:
    typedef _Ty result_type;
    typedef _Swc_Traits _Traits;
    typedef _Circ_buf<_Ty, _Rx> _Mybase;
    typedef typename _Swc_Traits::_Seed_t _Seed_t;

    static const size_t short_lag = _Sx;
    static const size_t long_lag = _Rx;

    _Swc_base()
        {   // construct with default seed
        seed();
        }

    _Swc_base(typename _Swc_Traits::_Seed_t _X0)
        {   // construct with specified seed
        seed(_X0);
        }

    template<class _Gen>
        _Swc_base(_Gen& _Gx)
        {   // construct with seed values from generator
        seed(_Gx);
        }

    void seed(unsigned long _Value = 19780503U)
        {   // set initial values from specified seed value
        _Seed(_Value, false, true_type());
        }

    template<class _Gen>
        void seed(_Gen& _Gx, bool _Readcy = false)
        {   // set initial values from range
        _Seed(_Gx, _Readcy, _Is_numeric<_Gen>());
        }

    result_type (min)() const
        {   // return minimum possible generated value
        return (0);
        }

    result_type (max)() const
        {   // return maximum possible generated value
        return (_Swc_Traits::_Max);
        }

    result_type operator()()
        {   // return next value
        int _Ix = 2 * _Rx <= this->_Idx ? 0 : this->_Idx;
        if (_Ix < _Sx)
            _Setx(_Ix, this->_Ax[_Ix + 2 * _Rx - _Sx],
                this->_Ax[_Ix + _Rx]);
        else if (_Ix < _Rx)
            _Setx(_Ix, this->_Ax[_Ix - _Sx], this->_Ax[_Ix + _Rx]);
        else
            _Setx(_Ix, this->_Ax[_Ix - _Sx], this->_Ax[_Ix - _Rx]);
        this->_Idx = _Ix + 1;
        return (this->_Ax[_Ix]);
        }

    void discard(unsigned long long _Nskip)
        {   // discard _Nskip elements
        for (; 0 < _Nskip; --_Nskip)
            (*this)();
        }

    bool _Equals(const _Swc_base& _Right) const
        {   // return true if *this will generate same sequence as _Right
        return (_Mybase::_Equals(_Right)
            && _Carry == _Right._Carry);
        }

    template<class _Elem, class _Traits>
        basic_ostream<_Elem, _Traits>&
            _Write(basic_ostream<_Elem, _Traits>& _Ostr) const
        {   // write state to _Ostr
        _Swc_Traits::_Write(_Ostr, *this, _Carry);
        return (_Ostr);
        }

protected:
    template<class _Gen>
        void _Seed(_Gen& _Gx, bool _Readcy, const true_type&)
        {   // reset sequence from numeric value
        linear_congruential<unsigned long, 40014, 0, 2147483563> _Lc(
            _Gx == 0 ? 19780503U : _Gx);
        _Reset(_Lc, _Readcy);
        }

    template<class _Gen>
        void _Seed(_Gen& _Gx, bool _Readcy, const false_type&)
        {   // reset sequence from generator
        _Reset(_Gx, _Readcy);
        }

    template<class _Gen>
        void _Reset(_Gen& _Gx, bool _Readcy)
        {   // reset sequence
        _Carry = _Swc_Traits::_Reset(_Gx, this->_Ax, _Readcy);
        this->_Idx = _Rx;
        }

    void _Setx(int _Ix, _Ty _First, _Ty _Second)
        {   // update _Ax[_Ix] and _Carry
        _Ty _Newx = (_First -= _Carry) - _Second;
        if (_First < _Second || _Swc_Traits::_Mod <= _Newx)
            {   // underflowed, so add _Mod
            _Newx += _Swc_Traits::_Mod;
            _Carry = _Swc_Traits::_Cy;
            }
        else
            _Carry = 0;
        this->_Ax[_Ix] = _Newx;
        }

    typename _Swc_Traits::_Cy_t _Carry;
    };

template<class _Ty,
    size_t _Sx,
    size_t _Rx,
    class _Swc_Traits>
    bool operator==(const _Swc_base<_Ty, _Sx, _Rx, _Swc_Traits>& _Left,
        const _Swc_base<_Ty, _Sx, _Rx, _Swc_Traits>& _Right)
        {   // return true if _Left will generate same sequence as _Right
        return (_Left._Equals(_Right));
        }

template<class _Ty,
    size_t _Sx,
    size_t _Rx,
    class _Swc_Traits>
    bool operator!=(const _Swc_base<_Ty, _Sx, _Rx, _Swc_Traits>& _Left,
        const _Swc_base<_Ty, _Sx, _Rx, _Swc_Traits>& _Right)
        {   // return true if _Left will not generate same sequence as _Right
        return (!_Left._Equals(_Right));
        }

template<class _Elem,
    class _Traits,
    class _Ty,
    size_t _Sx,
    size_t _Rx,
    class _Swc_Traits>
    basic_istream<_Elem, _Traits>&
        operator>>(basic_istream<_Elem, _Traits>& _Istr,
        _Swc_base<_Ty, _Sx, _Rx, _Swc_Traits>& _Eng)
        {   // read state from _Istr
        _Wrap_istream<_Elem, _Traits, typename _Swc_Traits::_Seed_t>
            _Gen(_Istr);
        _Eng.seed(_Gen, true);
        return (_Istr);
        }

template<class _Elem,
    class _Traits,
    class _Ty,
    size_t _Sx,
    size_t _Rx,
    class _Swc_Traits>
    basic_ostream<_Elem, _Traits>&
        operator<<(basic_ostream<_Elem, _Traits>& _Ostr,
        const _Swc_base<_Ty, _Sx, _Rx, _Swc_Traits>& _Eng)
        {   // write state to _Ostr
        return (_Eng._Write(_Ostr));
        }

template<class _Ty,
    size_t _Sx,
    size_t _Rx,
    class _Swc_Traits>
    const size_t _Swc_base<_Ty, _Sx, _Rx, _Swc_Traits>::short_lag;

template<class _Ty,
    size_t _Sx,
    size_t _Rx,
    class _Swc_Traits>
    const size_t _Swc_base<_Ty, _Sx, _Rx, _Swc_Traits>::long_lag;

    // TEMPLATE CLASS _Swc_traits
template<class _Ty,
    _Ty _Mx,
    size_t _Nw>
    struct _Swc_traits
    {   // traits template for subtract_with_carry generator
    typedef int _Cy_t;
    typedef _Ty _Mod_t;
    typedef _Ty _Seed_t;

    static const _Cy_t _Cy = 1;
    static const _Mod_t _Mod = _Mx;
    static const _Ty _Max = _Mx - 1;

    static int _Get_wc()
        {   // compute number of 32-bit words per element
        int _Kx;

        if (_Mx == 0)
            _Kx = (_BITS_BYTE * sizeof (_Ty) + 31) / 32;
        else
            {   // compute number of 32-bit words required
            _ULonglong _Val = (_ULonglong)1 << 32;
            for (_Kx = 1; 0 < _Val && _Val < _Mx; ++_Kx)
                _Val = _Val << 32;
            }
        return (_Kx);
        }

    template<class _Gen>
        static _Cy_t _Reset(_Gen& _Gx, _Ty *_Ax, bool _Readcy)
        {   // set initial values of _Ax from generator _Gx
            // return value of _Cy from range if _Readcy is true,
            // otherwise compute from last value
        int _Kx = _Get_wc();

        for (int _Ix = 0; _Ix < _Nw; ++_Ix)
            {   // pack _Kx words
            _Ax[_Ix] = _Gx();
            for (int _Jx = 0; ++_Jx < _Kx; )
                _Ax[_Ix] |= (_Ty)_Gx() << (32 * _Jx);
            }

        _Cy_t _Ans = _Reduce(_Ax);
        if (!_Readcy)
            return (_Ans);
        else
            return (_Gx());
        }

    static _Cy_t _Reduce(_Ty *_Ax)
        {   // reduce values to allowed range
        if (_Mx != 0)
            for (int _Ix = 0; _Ix < _Nw; ++_Ix)
                _Ax[_Ix] = _Ax[_Ix] % _Mx;
        return (_Ax[_Nw - 1] == 0);
        }

    template<class _Elem,
        class _Traits>
        static void _Write(basic_ostream<_Elem, _Traits>& _Ostr,
            const _Circ_buf<_Ty, _Nw>& _Buf, _Cy_t _Cy)
        {   // write state to _Ostr
        int _Kx = _Get_wc();

        for (int _Ix = 0; _Ix < _Nw; ++_Ix)
            for (int _Jx = 1; _Jx <= _Kx; ++_Jx)
                {   // unpack into _Kx words
                unsigned int _Word =
                    (unsigned int)(_Buf._At(_Ix) >> ((_Kx - _Jx) * 32));
                _Ostr << _Word << ' ';
                }
        _Ostr << _Cy;
        }
    };

    // TEMPLATE CLASS subtract_with_carry
template<class _Ty,
    _Ty _Mx,
    size_t _Sx,
    size_t _Rx>
    class subtract_with_carry
        : public _Swc_base<_Ty, _Sx, _Rx, _Swc_traits<_Ty, _Mx, _Rx> >
    {   // template class for subtract_with_carry generator
public:
    typedef subtract_with_carry<_Ty, _Mx, _Sx, _Rx> _Myt;
    typedef _Swc_base<_Ty, _Sx, _Rx, _Swc_traits<_Ty, _Mx, _Rx> > _Mybase;

    static const _Ty modulus = _Mx;

    static const _Ty default_seed = 19780503U;

    explicit subtract_with_carry(_Ty _X0 = default_seed)
        : _Mybase(_X0)
        {   // construct with default seed
        }

    subtract_with_carry(const _Myt& _Right)
        {   // construct by copying
        *this = _Right;
        }

    subtract_with_carry(_Myt& _Right)
        {   // construct by copying
        *this = _Right;
        }

    template<class _Gen>
        subtract_with_carry(_Gen& _Gx)
        : _Mybase(_Gx)
        {   // construct with seed values from generator
        }
    };

        // TEMPLATE CLASS subtract_with_carry_engine
template<class _Ty,
    size_t _Wx,
    size_t _Sx,
    size_t _Rx>
    class subtract_with_carry_engine
        : public subtract_with_carry<_Ty,
            (_Ty(1) << (_Wx - 1)) << 1, _Sx, _Rx>
    {   // template class for subtract_with_carry generator
public:
    static_assert(_Is_UIntType<_Ty>::value && 0U < _Sx && _Sx < _Rx
        && 0 < _Wx && _Wx <= numeric_limits<_Ty>::digits,
        "invalid template argument for subtract_with_carry_engine");

    typedef subtract_with_carry_engine<_Ty, _Wx, _Sx, _Rx> _Myt;

    static const _Ty _Mx = (_Ty(1) << (_Wx - 1)) << 1;
    static const size_t word_size = _Wx;
    static const size_t short_lag = _Sx;
    static const size_t long_lag = _Rx;

    typedef subtract_with_carry<_Ty, _Mx, _Sx, _Rx> _Mybase;
    typedef typename _Mybase::_Traits _Traits;
    typedef _Ty result_type;

    static const _Ty default_seed = 19780503U;

    explicit subtract_with_carry_engine(_Ty _X0 = default_seed)
        : _Mybase(_X0)
        {   // construct with default seed
        }

    subtract_with_carry_engine(const _Myt& _Right)
        {   // construct by copying
        *this = _Right;
        }

    subtract_with_carry_engine(_Myt& _Right)
        {   // construct by copying
        *this = _Right;
        }

    template<class _Seed_seq,
        class = typename enable_if<
            !is_convertible<_Seed_seq, _Ty>::value,
            void>::type>
        explicit subtract_with_carry_engine(_Seed_seq& _Seq)
        {   // construct from seed sequence
        seed(_Seq);
        }

    void seed(unsigned long _Value = 19780503U)
        {   // set initial values from specified seed value
        this->_Seed(_Value, false, true_type());
        }

    static const int _Kx = (_BITS_BYTE * sizeof (_Ty) + 31) / 32;

    template<class _Seed_seq>
        typename enable_if<
            !is_convertible<_Seed_seq, _Ty>::value,
                void>::type
        seed(_Seed_seq& _Seq)
        {   // reset sequence from seed sequence
        unsigned long _Arr[_Kx * _Rx];
        _Seq.generate(&_Arr[0], &_Arr[_Kx * _Rx]);

        int _Idx0 = 0;
        for (int _Ix = 0; _Ix < _Rx; ++_Ix, _Idx0 += _Kx)
            {   // pack _Kx words
            this->_Ax[_Ix] = _Arr[_Idx0];
            for (int _Jx = 0; ++_Jx < _Kx; )
                this->_Ax[_Ix] |= (_Ty)_Arr[_Idx0 + _Jx] << (32 * _Jx);

            if (_Traits::_Mod != 0)
                this->_Ax[_Ix] %= _Traits::_Mod;
            }
        this->_Carry = _Traits::_Reduce(this->_Ax);
        this->_Idx = _Rx;
        }

    static _Ty (min)()
        {   // return minimum possible generated value
        return (0);
        }

    static _Ty (max)()
        {   // return maximum possible generated value
        return (_Mx - 1);
        }
    };

    // TEMPLATE CLASS _Swc_01_traits
template<class _Ty,
    size_t _Wx,
    size_t _Rx>
    struct _Swc_01_traits
    {   // traits template for subtract_with_carry_01 generator
    typedef _Ty _Cy_t;
    typedef _Ty _Mod_t;
    typedef unsigned int _Seed_t;

    static const _Cy_t _Cy;
    static const _Mod_t _Mod;
    static const _Ty _Max;
    static const int _Nwords = (_Wx + 31) / 32;

    template<class _Gen>
        static _Cy_t _Reset(_Gen& _Gx, _Ty *_Ax, bool _Readcy)
        {   // set initial values of _Ax from generator _Gx
            // return value of _Cy from range if _Readcy is true,
            // otherwise from last value
        for (int _Ix = 0; _Ix < _Rx; ++_Ix)
            {   // read values
            _Ty _Factor = 1;
            _Ty _Val = 0;
            for (int _Jx = 0; _Jx < _Nwords - 1; ++_Jx)
                {   // read components of value
                _Factor /= (_Ty)_Two32;
                _Val += _Gx() * _Factor;
                }
            _Ty _Temp = ((unsigned long)_Gx() & _Mask) / _Scale1;
            _Val += (_Temp - (unsigned long)_Temp) * _Factor;
            _Ax[_Ix] = _Val;
            }
        if (!_Readcy)
            return (_Ax[_Rx - 1] != 0 ? 0 : _Cy);
        else
            return (_Gx() == 0 ? 0 : _Cy);
        }

    template<class _Elem,
        class _Traits>
        static void _Write(basic_ostream<_Elem, _Traits>& _Ostr,
            const _Circ_buf<_Ty, _Rx>& _Buf, _Cy_t _Cy)
        {   // write state to _Ostr
        for (int _Ix = 0; _Ix < _Rx; ++_Ix)
            {   // write values
            _Ty _Val = _Buf._At(_Ix);
            unsigned long _Temp;
            for (int _Jx = 0; _Jx < _Nwords - 1; ++_Jx)
                {   // write components of value
                _Val *= (_Ty)_Two32;
                _Temp = (unsigned long)_Val;
                _Val -= _Temp;
                _Ostr << _Temp << ' ';
                }
            _Temp = (unsigned long)(_Val * _Scale1);
            _Ostr << _Temp << ' ';
            }
        _Ostr << (_Cy ? 1 : 0);
        }

private:
    static const _Ty _Scale1;
    static const unsigned long _Mask;
    };

template<class _Ty,
    size_t _Wx,
    size_t _Rx>
    const typename _Swc_01_traits<_Ty, _Wx, _Rx>::_Cy_t
        _Swc_01_traits<_Ty, _Wx, _Rx>::_Cy =
            (typename _Swc_01_traits<_Ty, _Wx, _Rx>::_Cy_t)
                _CSTD ldexp(1.0, int(-ptrdiff_t(_Wx)));

template<class _Ty,
    size_t _Wx,
    size_t _Rx>
    const typename _Swc_01_traits<_Ty, _Wx, _Rx>::_Mod_t
        _Swc_01_traits<_Ty, _Wx, _Rx>::_Mod = 1;

template<class _Ty,
    size_t _Wx,
    size_t _Rx>
    const _Ty _Swc_01_traits<_Ty, _Wx, _Rx>::_Max = 1;

template<class _Ty,
    size_t _Wx,
    size_t _Rx>
    const _Ty _Swc_01_traits<_Ty, _Wx, _Rx>::_Scale1 =
        (_Ty)_CSTD ldexp(1.0, _Wx % 32);

template<class _Ty,
    size_t _Wx,
    size_t _Rx>
    const unsigned long _Swc_01_traits<_Ty, _Wx, _Rx>::_Mask =
        ~((~0UL) << (_Wx % 32));

    // TEMPLATE CLASS subtract_with_carry_01
template<class _Ty,
    size_t _Wx,
    size_t _Sx,
    size_t _Rx>
    class subtract_with_carry_01
        : public _Swc_base<_Ty, _Sx, _Rx, _Swc_01_traits<_Ty, _Wx, _Rx> >
    {   // template class for subtract_with_carry_01 generator
public:
    static const size_t word_size = _Wx;
    typedef _Swc_base<_Ty, _Sx, _Rx, _Swc_01_traits<_Ty, _Wx, _Rx> > _Mybase;

    subtract_with_carry_01()
        : _Mybase()
        {   // construct with default seed
        }

    subtract_with_carry_01(const subtract_with_carry_01& _Right)
        {   // construct by copying
        *this = _Right;
        }

    subtract_with_carry_01(subtract_with_carry_01& _Right)
        {   // construct by copying
        *this = _Right;
        }

    explicit subtract_with_carry_01(typename _Mybase::_Seed_t _Value)
        : _Mybase(_Value)
        {   // construct with specified seed
        }

    template<class _Gen>
        subtract_with_carry_01(_Gen& _Gx)
            : _Mybase(_Gx)
        {   // construct with seed values from generator
        }
    };

template<class _Ty,
    size_t _Wx,
    size_t _Sx,
    size_t _Rx>
    const size_t subtract_with_carry_01<_Ty, _Wx, _Sx, _Rx>::word_size;

    // TEMPLATE CLASS mersenne_twister
template<class _Ty,
    int _Wx,
    int _Nx,
    int _Mx,
    int _Rx,
    _Ty _Px,
    int _Ux,
    int _Sx,
    _Ty _Bx,
    int _Tx,
    _Ty _Cx,
    int _Lx>
    class mersenne_twister
        : public _Circ_buf<_Ty, _Nx>
    {   // template class for mersenne twister generator
public:
    typedef mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx,
        _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx> _Myt;
    typedef _Ty result_type;

    static const int word_size = _Wx;
    static const int state_size = _Nx;
    static const int shift_size = _Mx;
    static const int mask_bits = _Rx;
    static const _Ty parameter_a = _Px;
    static const int output_u = _Ux;
    static const int output_s = _Sx;
    static const _Ty output_b = _Bx;
    static const int output_t = _Tx;
    static const _Ty output_c = _Cx;
    static const int output_l = _Lx;

    static const _Ty default_seed = 5489U;

    explicit mersenne_twister(unsigned long _X0 = default_seed,
        _Ty _Dxarg = _WMSK,
        _Ty _Fxarg = (_Ty)1812433253)
        : _Dxval(_Dxarg)
        {   // construct with specified seed
        seed(_X0, _Fxarg);
        }

    mersenne_twister(const mersenne_twister& _Right)
        {   // construct by copying
        *this = _Right;
        }

    mersenne_twister(mersenne_twister& _Right)
        {   // construct by copying
        *this = _Right;
        }

    template<class _Gen>
        explicit mersenne_twister(_Gen& _Gx)
        : _Dxval(_WMSK)
        {   // construct with seed values from generator
        seed(_Gx);
        }

    void seed(unsigned long _X0 = default_seed,
        _Ty _Fx = (_Ty)1812433253)
        {   // set initial values from specified value
        _Ty _Prev = this->_Ax[0] = _X0 & _WMSK;
        for (int _Ix = 1; _Ix < _Nx; ++_Ix)
            _Prev = this->_Ax[_Ix] =
                (_Ix + _Fx * (_Prev ^ (_Prev >> (_Wx - 2)))) & _WMSK;
        this->_Idx = _Nx;
        }

    template<class _Gen>
        void seed(_Gen& _Gx, bool = false)
        {   // set initial values from range
        for (int _Ix = 0; _Ix < _Nx; ++_Ix)
            this->_Ax[_Ix] = _Gx() & _WMSK;
        this->_Idx = _Nx;
        }

    template<class _Elem,
        class _S_Traits>
        basic_ostream<_Elem, _S_Traits>&
            _Write(basic_ostream<_Elem, _S_Traits>& _Ostr) const
        {   // write state to _Ostr
        for (int _Ix = 0; _Ix < _Nx; ++_Ix)
            _Ostr << this->_At(_Ix) << ' ';
        return (_Ostr);
        }

    result_type (min)() const
        {   // return minimum possible generated value
        return (0);
        }

    result_type (max)() const
        {   // return maximum possible generated value
        return (_WMSK);
        }

    result_type operator()()
        {   // return next value
        if (this->_Idx == _Nx)
            _Refill_upper();
        else if (2 * _Nx <= this->_Idx)
            _Refill_lower();

        _Ty _Res = this->_Ax[this->_Idx++] & _WMSK;
        _Res ^= (_Res >> _Ux) & _Dxval;
        _Res ^= (_Res << _Sx) & _Bx;
        _Res ^= (_Res << _Tx) & _Cx;
        _Res ^= (_Res & _WMSK) >> _Lx;
        return (_Res);
        }

    void discard(unsigned long long _Nskip)
        {   // discard _Nskip elements
        for (; 0 < _Nskip; --_Nskip)
            (*this)();
        }

protected:

    _Post_satisfies_(this->_Idx == 0)

    void _Refill_lower()
        {   // compute values for the lower half of the history array
        int _Ix;
        for (_Ix = 0; _Ix < _Nx - _Mx; ++_Ix)
            {   // fill in lower region
            _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK)
                | (this->_Ax[_Ix + _Nx + 1] & _LMSK);
            this->_Ax[_Ix] = (_Tmp >> 1)
                ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix + _Nx + _Mx];
            }

        for (; _Ix < _Nx - 1; ++_Ix)
            {   // fill in upper region (avoids modulus operation)
            _Ty _Tmp = (this->_Ax[_Ix +_Nx] & _HMSK)
                | (this->_Ax[_Ix + _Nx + 1] & _LMSK);
            this->_Ax[_Ix] = (_Tmp >> 1)
                ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _Mx];
            }

        _Ty _Tmp = (this->_Ax[_Ix + _Nx] & _HMSK) | (this->_Ax[0] & _LMSK);
        this->_Ax[_Ix] = (_Tmp >> 1)
            ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Mx - 1];
        this->_Idx = 0;
        }

    void _Refill_upper()
        {   // compute values for the upper half of the history array
        int _Ix;
        for (_Ix = _Nx; _Ix < 2 * _Nx; ++_Ix)
            {   // fill in values
            _Ty _Tmp = (this->_Ax[_Ix - _Nx] & _HMSK)
                | (this->_Ax[_Ix - _Nx + 1] & _LMSK);
            this->_Ax[_Ix] = (_Tmp >> 1)
                ^ (_Tmp & 1 ? _Px : 0) ^ this->_Ax[_Ix - _Nx + _Mx];
            }
        }

    _Ty _Dxval;

    static const _Ty _WMSK = ~((~_Ty(0) << (_Wx - 1)) << 1);
    static const _Ty _HMSK = (_WMSK << _Rx) & _WMSK;
    static const _Ty _LMSK = ~_HMSK & _WMSK;
    };

template<class _Ty, int _Wx, int _Nx, int _Mx, int _Rx,
    _Ty _Px, int _Ux, int _Sx, _Ty _Bx, int _Tx, _Ty _Cx, int _Lx>
    bool operator==(
        const mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx,
            _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx>& _Left,
        const mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx,
            _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx>& _Right)
    {   // return true if _Left will generate same sequence as _Right
    return (_Left._Equals(_Right));
    }

template<class _Ty, int _Wx, int _Nx, int _Mx, int _Rx,
    _Ty _Px, int _Ux, int _Sx, _Ty _Bx, int _Tx, _Ty _Cx, int _Lx>
    bool operator!=(
        const mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx,
            _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx>& _Left,
        const mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx,
            _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx>& _Right)
    {   // return true if _Left will not generate same sequence as _Right
    return (!_Left._Equals(_Right));
    }

template<class _Elem, class _S_Traits,
    class _Ty, int _Wx, int _Nx, int _Mx, int _Rx,
    _Ty _Px, int _Ux, int _Sx, _Ty _Bx, int _Tx, _Ty _Cx, int _Lx>
    basic_istream<_Elem, _S_Traits>& operator>>(
        basic_istream<_Elem, _S_Traits>& _Istr,
        mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx,
            _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx>& _Eng)
    {   // read state from _Istr
    _Wrap_istream<_Elem, _S_Traits, _Ty> _Gen(_Istr);
    _Eng.seed(_Gen);
    return (_Istr);
    }

template<class _Elem, class _S_Traits,
    class _Ty, int _Wx, int _Nx, int _Mx, int _Rx,
    _Ty _Px, int _Ux, int _Sx, _Ty _Bx, int _Tx, _Ty _Cx, int _Lx>
    basic_ostream<_Elem, _S_Traits>& operator<<(
        basic_ostream<_Elem, _S_Traits>& _Ostr,
        const mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx,
            _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx>& _Eng)
    {   // write state to _Ostr
    return (_Eng._Write(_Ostr));
    }

    // TEMPLATE CLASS mersenne_twister_engine
template<class _Ty,
    size_t _Wx,
    size_t _Nx,
    size_t _Mx,
    size_t _Rx,
    _Ty _Px,
    size_t _Ux,
    _Ty _Dx,    // added
    size_t _Sx,
    _Ty _Bx,
    size_t _Tx,
    _Ty _Cx,
    size_t _Lx,
    _Ty _Fx>    // added
    class mersenne_twister_engine
        : public mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx,
            _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx>
    {   // template class for mersenne twister generator
public:
    static const unsigned long long
        _Max = (((1ULL << (_Wx - 1)) - 1) << 1) + 1;

    static_assert(_Is_UIntType<_Ty>::value && 0 < _Mx && _Mx <= _Nx
        && 2U < _Wx && _Rx <= _Wx && _Ux <= _Wx && _Sx <= _Wx && _Tx <= _Wx
        && _Lx <= _Wx && _Wx <= numeric_limits<_Ty>::digits && _Px <= _Max
        && _Bx <= _Max && _Cx <= _Max && _Dx <= _Max && _Fx <= _Max,
        "invalid template argument for mersenne_twister_engine");

    typedef mersenne_twister_engine<_Ty, _Wx, _Nx, _Mx, _Rx,
        _Px, _Ux, _Dx, _Sx, _Bx, _Tx, _Cx, _Lx, _Fx> _Myt;
    typedef mersenne_twister<_Ty, _Wx, _Nx, _Mx, _Rx,
        _Px, _Ux, _Sx, _Bx, _Tx, _Cx, _Lx> _Mybase;
    typedef _Ty result_type;

    static const size_t word_size = _Wx;
    static const size_t state_size = _Nx;
    static const size_t shift_size = _Mx;
    static const size_t mask_bits = _Rx;
    static const _Ty xor_mask = _Px;
    static const size_t tempering_u = _Ux;
    static const _Ty tempering_d = _Dx;
    static const size_t tempering_s = _Sx;
    static const _Ty tempering_b = _Bx;
    static const size_t tempering_t = _Tx;
    static const _Ty tempering_c = _Cx;
    static const size_t tempering_l = _Lx;
    static const _Ty initialization_multiplier = _Fx;

    static const result_type default_seed = 5489U;

    explicit mersenne_twister_engine(result_type _X0 = default_seed)
        : _Mybase((unsigned long)_X0, _Dx, _Fx)
        {   // construct with default seed
        }

    mersenne_twister_engine(const mersenne_twister_engine& _Right)
        {   // construct by copying
        *this = _Right;
        }

    mersenne_twister_engine(mersenne_twister_engine& _Right)
        {   // construct by copying
        *this = _Right;
        }

    template<class _Seed_seq,
        class = typename enable_if<
            !is_convertible<_Seed_seq, _Ty>::value,
            void>::type>
        explicit mersenne_twister_engine(_Seed_seq& _Seq)
        : _Mybase((unsigned long)default_seed, _Dx, _Fx)
        {   // construct from seed sequence
        seed(_Seq);
        }

    void seed(unsigned long _X0 = default_seed)
        {   // set initial values from specified value
        _Mybase::seed(_X0, _Fx);
        }

    template<class _Seed_seq>
        typename enable_if<
            !is_convertible<_Seed_seq, _Ty>::value,
                void>::type
        seed(_Seed_seq& _Seq)
        {   // reset sequence from seed sequence
        static const int _Kx = (_Wx + 31) / 32;
        unsigned long _Arr[_Kx * _Nx];
        _Seq.generate(&_Arr[0], &_Arr[_Kx * _Nx]);

        int _Idx0 = 0;
        _Ty _Sum = 0;
        for (int _Ix = 0; _Ix < _Nx; ++_Ix, _Idx0 += _Kx)
            {   // pack _Kx words
            this->_Ax[_Ix] = _Arr[_Idx0];
            for (int _Jx = 0; ++_Jx < _Kx; )
                this->_Ax[_Ix] |= (_Ty)_Arr[_Idx0 + _Jx] << (32 * _Jx);
            this->_Ax[_Ix] &= this->_WMSK;

            if (_Ix == 0)
                _Sum = this->_Ax[_Ix] >> _Rx;
            else
                _Sum |= this->_Ax[_Ix];
            }
        if (_Sum == 0)
            this->_Ax[0] = this->_WMSK;

        this->_Idx = _Nx;
        }

    static result_type (min)()
        {   // return minimum possible generated value
        return (0);
        }

    static result_type (max)()
        {   // return maximum possible generated value
        return (_Mybase::_WMSK);
        }
    };

    // TEMPLATE CLASS discard_block
template<class _Engine,
    int _Px,
    int _Rx>
    class discard_block
    {   // template class for discard_block compound engine
public:
    typedef discard_block<_Engine, _Px, _Rx> _Myt;
    typedef _Engine base_type;
    typedef typename _Engine::result_type result_type;

    static const int block_size = _Px;
    static const int used_block = _Rx;

    discard_block()
        : _Eng(), _Nx(0)
        {   // construct
        }

    discard_block(const discard_block& _Right)
        {   // construct by copying
        *this = _Right;
        }

    discard_block(discard_block& _Right)
        {   // construct by copying
        *this = _Right;
        }

    explicit discard_block(const base_type& _Ex)
        : _Eng(_Ex), _Nx(0)
        {   // construct with engine initializer _Ex
        }

    explicit discard_block(result_type _Seed)
        : _Eng(_Seed), _Nx(0)
        {   // construct from specified seed value
        }


    template<class _Seed_seq,
        class = typename enable_if<
            !is_convertible<_Seed_seq, result_type>::value,
            void>::type>
        explicit discard_block(_Seed_seq& _Seq)
        : _Eng(_Seq), _Nx(0)
        {   // construct from seed sequence
        }


    void seed()
        {   // seed engine from default value
        _Eng.seed();
        _Nx = 0;
        }

    void seed(result_type _X0)
        {   // seed engine from specified value
        _Eng.seed(_X0);
        _Nx = 0;
        }

    template<class _Seed_seq>
        typename enable_if<
            !is_convertible<_Seed_seq, result_type>::value,
                void>::type
        seed(_Seed_seq& _Seq)
        {   // seed engine from seed sequence
        _Eng.seed(_Seq);
        _Nx = 0;
        }


    const base_type& base() const _NOEXCEPT
        {   // return const reference to engine
        return (_Eng);
        }

    result_type (min)() const
        {   // return minimum possible generated value
        return ((_Eng.min)());
        }

    result_type (max)() const
        {   // return maximum possible generated value
        return ((_Eng.max)());
        }

    result_type operator()()
        {   // return next value
        if (_Rx <= _Nx)
            {   // discard values
            while (_Nx++ < _Px)
                _Eng();
            _Nx = 0;
            }
        ++_Nx;
        return (_Eng());
        }

    void discard(unsigned long long _Nskip)
        {   // discard _Nskip elements
        for (; 0 < _Nskip; --_Nskip)
            (*this)();
        }

    bool _Equals(const _Myt& _Right) const
        {   // return true if *this will generate same sequence as _Right
        return (_Eng == _Right._Eng && _Nx == _Right._Nx);
        }

    template<class _Elem,
        class _Traits>
        basic_istream<_Elem, _Traits>& _Read(
            basic_istream<_Elem, _Traits>& _Istr)
        {   // read state from _Istr
        return (_Istr >> _Eng >> _Nx);
        }

    template<class _Elem,
        class _Traits>
        basic_ostream<_Elem, _Traits>& _Write(
            basic_ostream<_Elem, _Traits>& _Ostr) const
        {   // write state to _Ostr
        return (_Ostr << _Eng << ' ' << _Nx);
        }

private:
    base_type _Eng;
    int _Nx;
    };

template<class _Engine,
    int _Px,
    int _Rx>
    const int discard_block<_Engine, _Px, _Rx>::block_size;

template<class _Engine,
    int _Px,
    int _Rx>
    const int discard_block<_Engine, _Px, _Rx>::used_block;

template<class _Engine,
    int _Px,
    int _Rx>
    bool operator==(
        const discard_block<_Engine, _Px, _Rx>& _Left,
        const discard_block<_Engine, _Px, _Rx>& _Right)
    {   // return true if _Left will generate same sequence as _Right
    return (_Left._Equals(_Right));
    }

template<class _Engine,
    int _Px,
    int _Rx>
    bool operator!=(
        const discard_block<_Engine, _Px, _Rx>& _Left,
        const discard_block<_Engine, _Px, _Rx>& _Right)
    {   // return true if _Left will not generate same sequence as _Right
    return (!(_Left == _Right));
    }

template<class _Elem,
    class _Traits,
    class _Engine,
    int _Px,
    int _Rx>
    basic_istream<_Elem, _Traits>& operator>>(
        basic_istream<_Elem, _Traits>& _Istr,
        discard_block<_Engine, _Px, _Rx>& _Eng)
    {   // read state from _Istr
    return (_Eng._Read(_Istr));
    }

template<class _Elem,
    class _Traits,
    class _Engine,
    int _Px,
    int _Rx>
    basic_ostream<_Elem, _Traits>& operator<<(
        basic_ostream<_Elem, _Traits>& _Ostr,
        const discard_block<_Engine, _Px, _Rx>& _Eng)
    {   // write state to _Ostr
    return (_Eng._Write(_Ostr));
    }

    // TEMPLATE CLASS discard_block_engine
template<class _Engine,
    size_t _Px,
    size_t _Rx>
    class discard_block_engine
        : public discard_block<_Engine, _Px, _Rx>
    {   // template class for discard_block_engine compound engine
public:
    static_assert(0 < _Rx && _Rx <= _Px,
        "invalid template argument for discard_block_engine");

    typedef discard_block_engine<_Engine, _Px, _Rx> _Myt;
    typedef discard_block<_Engine, _Px, _Rx> _Mybase;
    typedef typename _Engine::result_type result_type;

    discard_block_engine()
        : _Mybase()
        {   // default construct
        }

    discard_block_engine(const discard_block_engine& _Right)
        {   // construct by copying
        *this = _Right;
        }

    discard_block_engine(discard_block_engine& _Right)
        {   // construct by copying
        *this = _Right;
        }

    explicit discard_block_engine(const _Engine& _Ex)
        : _Mybase(_Ex)
        {   // construct with engine initializer _Ex
        }

    explicit discard_block_engine(_Engine& _Ex)
        : _Mybase((const _Engine&)_Ex)
        {   // construct with engine initializer _Ex
        }

    explicit discard_block_engine(_Engine&& _Ex)
        : _Mybase(_STD forward<_Engine>(_Ex))
        {   // construct with engine initializer _Ex
        }

    explicit discard_block_engine(result_type _X0)
        : _Mybase(_X0)
        {   // construct from specified seed value
        }

    template<class _Seed_seq,
        class = typename enable_if<
            !is_convertible<_Seed_seq, result_type>::value,
            void>::type>
        explicit discard_block_engine(_Seed_seq& _Seq)
        : _Mybase(_Seq)
        {   // construct from seed sequence
        }

    static typename _Engine::result_type (min)()
        {   // return minimum possible generated value
        return ((_Engine::min)());
        }

    static typename _Engine::result_type (max)()
        {   // return maximum possible generated value
        return ((_Engine::max)());
        }
    };

    // TEMPLATE CLASS independent_bits_engine
template<class _Engine,
    size_t _Wx,
    class _UIntType>
    class independent_bits_engine
    {   // template class for independent_bits_engine compound engine
public:
    static_assert(_Is_UIntType<_UIntType>::value
        && 0 < _Wx && _Wx <= numeric_limits<_UIntType>::digits,
        "invalid template argument for independent_bits_engine");

    typedef independent_bits_engine<_Engine, _Wx, _UIntType> _Myt;
    typedef _Engine base_type;
    typedef _UIntType result_type;
    typedef typename _Engine::result_type _Eres;

    independent_bits_engine()
        {   // construct
        _Init();
        }

    independent_bits_engine(const independent_bits_engine& _Right)
        {   // construct by copying
        *this = _Right;
        }

    independent_bits_engine(independent_bits_engine& _Right)
        {   // construct by copying
        *this = _Right;
        }

    explicit independent_bits_engine(const _Engine& _Ex)
        : _Eng(_Ex)
        {   // construct with engine initializer _Ex
        _Init();
        }

    explicit independent_bits_engine(_Engine& _Ex)
        : _Eng((const _Engine&)_Ex)
        {   // construct with engine initializer _Ex
        _Init();
        }

    explicit independent_bits_engine(_Engine&& _Ex)
        : _Eng(_STD forward<_Engine>(_Ex))
        {   // construct with engine initializer _Ex
        _Init();
        }

    explicit independent_bits_engine(result_type _X0)
        : _Eng(_X0)
        {   // construct from specified seed value
        _Init();
        }

    template<class _Seed_seq,
        class = typename enable_if<
            !is_convertible<_Seed_seq, result_type>::value,
            void>::type>
        explicit independent_bits_engine(_Seed_seq& _Seq)
        : _Eng(_Seq)
        {   // construct from seed sequence
        _Init();
        }

    void seed()
        {   // seed engine from default value
        _Eng.seed();
        }

    void seed(result_type _X0)
        {   // seed engine from specified value
        _Eng.seed(_X0);
        }

    template<class _Seed_seq>
        typename enable_if<
            !is_convertible<_Seed_seq, result_type>::value,
                void>::type
        seed(_Seed_seq& _Seq)
        {   // seed engine from seed sequence
        _Eng.seed(_Seq);
        }

    const _Engine& base() const _NOEXCEPT
        {   // return const reference to engine
        return (_Eng);
        }

    static result_type (min)()
        {   // return minimum possible generated value
        return (0);
        }

    static result_type (max)()
        {   // return maximum possible generated value
        return ((((result_type)1 << (_Wx - 1)) << 1) - 1);
        }

    result_type operator()()
        {   // return next value
        size_t _Idx = 0;
        result_type _Res = 0;
        result_type _Mask = (((result_type)1 << (_W0 - 1)) << 1) - 1;
        _Eres _Val;

        for (; _Idx < _N0; ++_Idx)
            {   // pack _W0-bit values
            for (; ; )
                {   // get a small enough value
                _Val = _Eng() -  (_Eng.min)();
                if (_Val <= _Y0)
                    break;
                }
            _Res = _Res << _W0 | _Val & _Mask;
            }

        _Mask = _Mask << 1 | 1;
        for (; _Idx < _Nx; ++_Idx)
            {   // pack _W0+1-bit values
            for (; ; )
                {   // get a small enough value
                _Val = _Eng() -  (_Eng.min)();
                if (_Val <= _Y1)
                    break;
                }
            _Res = (_Res << (_W0 + 1)) | _Val & _Mask;
            }
        return (_Res);
        }

    void discard(unsigned long long _Nskip)
        {   // discard _Nskip elements
        for (; 0 < _Nskip; --_Nskip)
            (*this)();
        }

    template<class _Elem,
        class _Traits>
        basic_istream<_Elem, _Traits>& _Read(
            basic_istream<_Elem, _Traits>& _Istr)
        {   // read state from _Istr
        return (_Istr >> _Eng);
        }

    template<class _Elem,
        class _Traits>
        basic_ostream<_Elem, _Traits>& _Write(
            basic_ostream<_Elem, _Traits>& _Ostr) const
        {   // write state to _Ostr
        return (_Ostr << _Eng);
        }

private:
    void _Init()
        {   // compute values for operator()
        size_t _Mx = 0;
        _Eres _Rx = (_Eng.max)() -  (_Eng.min)() + 1;

        _Eres _Tmp = _Rx;
        if (_Tmp == 0)
            {   // all bits used, make _Rx finite
            _Mx = 1;
            --_Tmp;
            }
        for (; 1 < _Tmp; _Tmp >>= 1)
            ++_Mx;  // compute _Mx = floor(log2(_Rx))

        for (size_t _Nfix = 0; ; ++_Nfix)
            {   // compute consistent set of parameters
            _Nx = (_Wx + _Mx - 1) / _Mx + _Nfix;    // trial _Nx
            _W0 = _Wx / _Nx;
            _N0 = _Nx - _Wx % _Nx;
            _Y0 = (_Rx >> _W0) << _W0;
            _Y1 = (((_Rx >> _W0) >> 1) << _W0) << 1;
            if (_Nfix == 1 || _Rx - _Y0 <= _Y0 / _Nx)
                break;  // also works if _Rx == 0 (_Mx == all bits)
            }
        --_Y0;
        --_Y1;
        }

    _Engine _Eng;   // the stored engine
    size_t _N0;     // number of smaller packing words
    size_t _Nx;     // total number of packing words
    size_t _W0;     // bits per smaller packing word
    _Eres _Y0;      // max value for smaller packing word
    _Eres _Y1;      // max value for larger packing word
    };

template<class _Engine,
    size_t _Wx,
    class _UIntType>
    bool operator==(
        const independent_bits_engine<_Engine, _Wx, _UIntType>& _Left,
        const independent_bits_engine<_Engine, _Wx, _UIntType>& _Right)
    {   // return true if _Left will generate same sequence as _Right
    return (_Left.base() == _Right.base());
    }

template<class _Engine,
    size_t _Wx,
    class _UIntType>
    bool operator!=(
        const independent_bits_engine<_Engine, _Wx, _UIntType>& _Left,
        const independent_bits_engine<_Engine, _Wx, _UIntType>& _Right)
    {   // return true if _Left will not generate same sequence as _Right
    return (!(_Left == _Right));
    }

template<class _Elem,
    class _Traits,
    class _Engine,
    size_t _Wx,
    class _UIntType>
    basic_istream<_Elem, _Traits>& operator>>(
        basic_istream<_Elem, _Traits>& _Istr,
        independent_bits_engine<_Engine, _Wx, _UIntType>& _Eng)
    {   // read state from _Istr
    return (_Eng._Read(_Istr));
    }

template<class _Elem,
    class _Traits,
    class _Engine,
    size_t _Wx,
    class _UIntType>
    basic_ostream<_Elem, _Traits>& operator<<(
        basic_ostream<_Elem, _Traits>& _Ostr,
        const independent_bits_engine<_Engine, _Wx, _UIntType>& _Eng)
    {   // write state to _Ostr
    return (_Eng._Write(_Ostr));
    }

    // TEMPLATE CLASS shuffle_order_engine
template<class _Engine,
    size_t _Kx>
    class shuffle_order_engine
    {   // template class for shuffle_order_engine compound engine
public:
    static_assert(0 < _Kx,
        "invalid template argument for shuffle_order_engine");

    typedef shuffle_order_engine<_Engine, _Kx> _Myt;
    typedef _Engine base_type;
    typedef typename _Engine::result_type result_type;

    static const size_t table_size = _Kx;

    shuffle_order_engine()
        {   // construct
        _Init();
        }

    shuffle_order_engine(const shuffle_order_engine& _Right)
        {   // construct by copying
        *this = _Right;
        }

    shuffle_order_engine(shuffle_order_engine& _Right)
        {   // construct by copying
        *this = _Right;
        }

    explicit shuffle_order_engine(const _Engine& _Ex)
        : _Eng(_Ex)
        {   // construct with engine initializer _Ex
        _Init();
        }

    explicit shuffle_order_engine(_Engine& _Ex)
        : _Eng(_Ex)
        {   // construct with engine initializer _Ex
        _Init();
        }

    explicit shuffle_order_engine(_Engine&& _Ex)
        : _Eng(_STD forward<_Engine>(_Ex))
        {   // construct with engine initializer _Ex
        _Init();
        }

    explicit shuffle_order_engine(result_type _X0)
        : _Eng(_X0)

Библиотека шаблонов классов, что ли...

Похоже, что это файл random из STL.

Defines many random number generators, including true uniformly distributed generators.

Подробности здесь: MSDN: <random>

Наверху написано

// random TR1 header  - вот это
#pragma once
#ifndef _RANDOM_
#define _RANDOM_
#ifndef RC_INVOKED
#include <istream>
#include <vector>

Внимание! Это довольно старый топик, посты в него не попадут в новые, и их никто не увидит. Пишите пост, если хотите просто дополнить топик, а чтобы задать новый вопрос — начните новый.

Ответить

Вы можете использовать разметку markdown для оформления комментариев и постов. Используйте функцию предпросмотра для проверки корректности разметки.

Пожалуйста, оформляйте исходный код в соответствии с правилами разметки. Для того, чтобы вставить код в комментарий, скопируйте его в текстовое поле ниже, после чего выделите то, что скопировали и нажмите кнопку «код» в панели инструментов. Иначе ваш код может принять нечитаемый вид.

Либо производите оформление кода вручную, следующим образом:

``` #include <iostream> using namespace std; int main() { // ... } ```

Предпросмотр сообщения

Ваше сообщение пусто.