G4m4 / soundtailor

Sound synthesis algorithms
GNU General Public License v3.0
1 stars 1 forks source link

The random generation is the same at each loop iteration #20

Open G4m4 opened 10 years ago

G4m4 commented 10 years ago

When a loop body contain a random generation such as:

std::generate(data.begin(), data.end(), std::bind(kNormDistribution, kRandomGenerator));

The random engine actually gets reinitialised at each loop iteration, resulting in the data being the same at each iteration. This has to be fixed.

G4m4 commented 10 years ago

This may be fixed by using a lambda:

std::generate(data.begin(), data.end(), [&] {return kNormDistribution(kRandomGenerator);});