J
Joe
Hi, I have been working on some code that requires a high use of random
numbers within. Mostly I either have to either:
1) flip a coin i.e. 0 or 1, or
2) generate a double between 0 and 1.
I have utilised the following random number source code
http://www.agner.org/random/
What I have found is that there is a problem with seeding. The code
generates a seed based on time(0). I have found that I need to increment
seed and
A snippet of my code is below. I basically generate a Population object that
contains various individuals. I want to randomly choose two individuals from
this population. I wish I could choose these individuals by the following:
// get two parents
ind1 = pool.RouletteWheel();
ind2 = pool.RouletteWheel();
numbers within. Mostly I either have to either:
1) flip a coin i.e. 0 or 1, or
2) generate a double between 0 and 1.
I have utilised the following random number source code
http://www.agner.org/random/
What I have found is that there is a problem with seeding. The code
generates a seed based on time(0). I have found that I need to increment
seed and
A snippet of my code is below. I basically generate a Population object that
contains various individuals. I want to randomly choose two individuals from
this population. I wish I could choose these individuals by the following:
// get two parents
ind1 = pool.RouletteWheel();
ind2 = pool.RouletteWheel();