ofxDna
ofxDna copied to clipboard
typo at line 140 of ofxDna.cpp
Is: ofxDna * ofxDna::mutate(float prob, float amout) {
Should be: ofxDna * ofxDna::mutate(float prob, float amount) {
Thanks! Jason
hi jason
i must have a more recent version in my machine, that harmless error is not present in my recent code, attached here
ofxDna * ofxDna::mutate(float prob, float amount) { incGeneration(); // for (int i = 0; i < num; i++) { // float rnd = random(1f); // if (rnd > a && rnd < b) // dna[i] = random(1.0000001f); // } // return this; for (int i = 0; i < num; i++) { if (ofRandom(1) < prob) dna[i] += ofRandom(-amount, amount); } bound(); return this; }
No problem... while you're at it, you should add the ofxDna.cpp to all of the examples since they will error out without.
On Tue, Apr 23, 2013 at 7:28 PM, André Sier [email protected]:
hi jason
i must have a more recent version in my machine, that harmless error is not present in my recent code, attached here
ofxDna * ofxDna::mutate(float prob, float amount) { incGeneration(); // for (int i = 0; i < num; i++) { // float rnd = random(1f); // if (rnd > a && rnd < b) // dna[i] = random(1.0000001f); // } // return this; for (int i = 0; i < num; i++) { if (ofRandom(1) < prob) dna[i] += ofRandom(-amount, amount); } bound(); return this; }
— Reply to this email directly or view it on GitHubhttps://github.com/s373/ofxDna/issues/1#issuecomment-16893347 .