Besides the uniform distribution, I do not know other types of distribution that can be used directly on the matrix. What you can do is map the uniform distribution provided by Eigen directly into your custom distribution (if the mapping exists).
Suppose your distribution is a sigmoid. You can map the uniform distribution into a sigmoid distribution using the function y = a / (b + c exp (x)).
By temporarily converting your matrix to an array, you can control over the elements in all the values ββof your matrix:
Matrix3f uniformM; uniformM.setRandom(); Matrix3f sigmoidM; sigmoidM.array() = a * ((0.5*uniformM+0.5).array().exp() * c + b).inv();
source share