I am writing code to generate an NxN matrix of 0s and 1s in XTensor where the probability of an entry being 1 is 1/N. Additionally, I want to discard all values on the diagonal and above. Finally, I want to find the indices of all 1s. Hence, I am using the following code:
auto binomial = xt::tril(
xt::random::binomial(
xt::shape<uint32_t>({N, N}), 1, 1/N
),
1
);
std::vector<std::array<unsigned int, 2>> vals = xt::argwhere(binomial);
The expected size of vals here should be N. This is true when I try N=100, N=1000, N=10000, but does not hold when I try N=100000. Are there any limitations to this approach that I am not aware of?