Function genann_randomize

Synopsis

#include <genann.h>

void genann_randomize(genann *ann)

Description

Sets weights randomly. Called by init.

Mentioned in

Source

Lines 195-202 in genann.c. Line 80 in genann.h.

void genann_randomize(genann *ann) {
    int i;
    for (i = 0; i < ann->total_weights; ++i) {
        double r = GENANN_RANDOM();
        /* Sets weights from -0.5 to 0.5. */
        ann->weight[i] = r - 0.5;
    }
}





Add Discussion as Guest

Log in