This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Weird behavior of VectorXi::Random()

Tags: None
(comma "," separated)
sth4nth
Registered Member
Posts
13
Karma
0
VectorXi::Random() seems always return random integers from [-10,10]. Is this by design? and Why?
sth4nth
Registered Member
Posts
13
Karma
0
sth4nth wrote:VectorXi::Random() seems always return random integers from [-10,10]. Is this by design? and Why?


Forgot to mention that I'm using Eigen 3 beta1, the code is simply

cout<< VectorXi::Random(20);
User avatar
bjacob
Registered Member
Posts
658
Karma
3
It's true. The reason was that I wanted to get nice-looking examples in the documentation, which I admit is a pretty bad reason. I guess we should switch the default uniform distribution over the integer type's range, and keep a compile-time option for the old behavior for making the docs.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
User avatar
bjacob
Registered Member
Posts
658
Karma
3


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
sth4nth
Registered Member
Posts
13
Karma
0
bjacob wrote:It's true. The reason was that I wanted to get nice-looking examples in the documentation, which I admit is a pretty bad reason. I guess we should switch the default uniform distribution over the integer type's range, and keep a compile-time option for the old behavior for making the docs.


That will be great. Thanks.
Btw, I think random number generators really should be optimized both on the efficiency and random cycle lengths, since they are crucial for some applications like statistics and Monte Carlo simulation.
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Our random generator is not optimized at all, and we don't have a big interest in that, it's not our specialty; if this is performance critical to you, you should use your own.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], Sogou [Bot]