Use faster random engine
This commit is contained in:
parent
fc0840d79d
commit
075b35d5d0
5 changed files with 6 additions and 6 deletions
|
|
@ -21,13 +21,13 @@ sf::Vector2f Chromosome::size(0, 0);
|
|||
float Chromosome::stddev_position = .1;
|
||||
float Chromosome::stddev_radius = .1;
|
||||
float Chromosome::stddev_color = 20;
|
||||
std::mt19937_64* Chromosome::re;
|
||||
std::minstd_rand* Chromosome::re;
|
||||
|
||||
|
||||
Chromosome::Chromosome()
|
||||
{
|
||||
// this->genes is already empty
|
||||
this->circle.setPointCount(50);
|
||||
this->circle.setPointCount(36);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public:
|
|||
static float stddev_position; // percent of max_radius
|
||||
static float stddev_radius; // percent of max_radius
|
||||
static float stddev_color;
|
||||
static std::mt19937_64* re;
|
||||
static std::minstd_rand* re;
|
||||
|
||||
Chromosome(); // create empty chromosome
|
||||
Chromosome(Chromosome& father, Chromosome& mother); // crossover
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
size_t Generation::size = 500;
|
||||
size_t Generation::living = Generation::size*0.25;
|
||||
Fitness* Generation::fitness;
|
||||
std::mt19937_64* Generation::re;
|
||||
std::minstd_rand* Generation::re;
|
||||
|
||||
|
||||
Generation::Generation()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
static size_t size;
|
||||
static size_t living;
|
||||
static Fitness* fitness;
|
||||
static std::mt19937_64* re;
|
||||
static std::minstd_rand* re;
|
||||
|
||||
Generation();
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ int main()
|
|||
{
|
||||
const float winW = 480;
|
||||
const float winH = 480;
|
||||
std::mt19937_64 randomEngine;
|
||||
std::minstd_rand randomEngine;
|
||||
randomEngine.seed(time(nullptr));
|
||||
|
||||
sf::Texture target;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue