This repository has been archived on 2026-03-28. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
eodev/src/doBounderRng.h
Caner Candan a038586edb + do files
2010-07-05 19:04:35 +02:00

35 lines
777 B
C++

#ifndef _doBounderRng_h
#define _doBounderRng_h
#include "doBounder.h"
template < typename EOT >
class doBounderRng : public doBounder< EOT >
{
public:
doBounderRng( EOT min, EOT max, eoRndGenerator< double > & rng )
: doBounder< EOT >( min, max ), _rng(rng)
{}
void operator()( EOT& x )
{
unsigned int size = x.size();
assert(size > 0);
for (unsigned int d = 0; d < size; ++d) // browse all dimensions
{
// FIXME: attention: les bornes RNG ont les memes bornes quelque soit les dimensions idealement on voudrait avoir des bornes differentes pour chaque dimensions.
if (x[d] < this->min()[d] || x[d] > this->max()[d])
{
x[d] = _rng();
}
}
}
private:
eoRndGenerator< double> & _rng;
};
#endif // !_doBounderRng_h