I need to generate a large number of random multiprecision ints (boost mpx_int) of various bits. My current approach is based on these two examples: boost multiprecision random, constexpr array. To generate a random number this way I need the number of bits as a constexpr. I can generate an array of constexpr ints, but then I get stuck because I cannot access them from within a for loop.
Code example:
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/random.hpp>
#include <iostream>
using namespace std;
using namespace boost::multiprecision;
using namespace boost::random;
template <int bit_limit>
struct N_bit_nums
{
    constexpr N_bit_nums() : bits{}
    {
        for (int i = 0; i < bit_limit; ++i)
        {
            bits[i] = i + 1;
        }
    }
    int bits[bit_limit];
};
int main()
{
    constexpr int bit_limit = 3; // this will actually be on the order of 10^6
    constexpr N_bit_nums<bit_limit> n_bit_nums{};
    for (int i = 0; i < bit_limit; ++i)
    {
        independent_bits_engine<mt19937, n_bit_nums.bits[i], cpp_int> generator; // error: the value of ‘i’ is not usable in a constant expression
        cpp_int rand_num = generator();
        cout << rand_num << "\n"; // just to see what is going on while testing
    }
    return 0;
}
