Closed felbecker closed 5 years ago
I have just tested it under Linux. After every run I get a new sequence.
Example:
The mutation works also under Linux: (Mutation probability = 1 (100%) ) seq1 TGGCATGCCCCTGACTTATCTATATCGGCG seq2 AGAAGTTGCGGAAAACCGCGGGCCGCCTTA seq3 CATGCTCACCGTTCGGACGGCCGGTGCCCG
Mutation Probability = 0.2 (20%) seq1 GCGCAATTGAGCCGTCTTATACACGGTAGC seq2 GCGTATTTGATCCGTCTCGTACACGGTAGT seq3 GCGTTAATGAACCGGCTTTTAGTCGGTAGT
I made a pull request with the new seed simulation. I hope it works under windows.
Fixed in #35
I just tested the sequence simulation code (at home under windows). It does produce the same sequence every time I run the program. Also the sequences are not mutated at all. I suspect that this is a seed initialization problem. Do you get different sequences for each execution of the program on your system? Do mutations work?
I researched a bit and found that std::random_device is deterministic under MINGW/Windows, but non-deterministic under linux, which is a ugly thing as we want code to be portable and work the same on every system.
As a solution I would try to not use std::random_device and set the seed using the current system time instead:
(and remove the line with the random device)
The issue with the mutations not working might be unrelated to this. Since you generate random doubles there, you should use
std::uniform_real_distribution
(https://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution) for the random mutation probability, not the random device as you currently do.