davidrmiller / biosim4

Biological evolution simulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typo in random gene creation?

jeremy-pereira opened this issue · comments

I'm looking to create my own evolution simulation and this code base seemed like an excellent place to start, so I was perusing the code and I came across the gene declaration and the makeRandomWeight code.

struct Gene { //__attribute__((packed)) Gene {

    // <SNIP>

    static int16_t makeRandomWeight() { return randomUint(0, 0xefff) - 0x8000; }
};

Why 0xefff? Are you deliberately trying to create weights that are biased towards the negative? Or is it a typo for 0xffff?

That looks like a typo or a lingering remnant of some previous design change. Eventually, mutations should overwhelm the effects of this starting bias, but you're right, this does look like biased starting conditions. I'll fix that. Thanks for finding this.

Edit: fixed in main branch.