ofxDna icon indicating copy to clipboard operation
ofxDna copied to clipboard

typo at line 140 of ofxDna.cpp

Open ghost opened this issue 11 years ago • 2 comments

Is: ofxDna * ofxDna::mutate(float prob, float amout) {

Should be: ofxDna * ofxDna::mutate(float prob, float amount) {

Thanks! Jason

ghost avatar Apr 23 '13 19:04 ghost

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; }

s373 avatar Apr 23 '13 23:04 s373

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 .

ghost avatar Apr 24 '13 14:04 ghost