In a small application written in C/C++, I am facing a problem with the rand
function and maybe the seed :
I want to produce a sequence of random numbers that are of different orders, i.e. with different logarithm values (base 2). But it seems that all the numbers produced are of the same order, fluctuating just between 2^25 and 2^30.
Is it because rand()
is seeded with Unix time which is by now a relatively big number? What am I forgetting ?
I am seeding rand()
only once at the beginning of the main()
.
rand()
to return uniformly distributed numbers (documentation with high Google ranking explicitly says so) I don't think this question is useful for future readers. That's why down vote but don't let it discourage you from using SO. – Emperor Orionii