Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //file: myclass.h
- status myclass::doThat(param1, param2){
- bool cond = shouldIStop(param1, param2, param3, param4);
- status myStatus = NOTLEAF;
- if(!cond){
- ...
- doSomething(param3, param4);
- ...
- ...
- ...
- doThat(param1, param2, param3, param4);
- }
- else{
- ...
- ...
- myStatus = LEAF;
- ...
- }
- return (myStatus);
- }
- void myclass::doSomething(double treshmin, double treshmax)
- {
- std::random_device rd;
- static std::mt19937 engine(rd());
- .....
- double curThreshold = randomDoubleEngine(engine, treshmin, treshmax );
- ...
- }
- //file: utilities.h
- template <typename Generator>
- double randomDoubleEngine(Generator& engine, double low_bound, double high_bound )
- {
- if (low_bound > high_bound){
- std::swap(low_bound, high_bound);
- }
- return std::uniform_real_distribution<>( low_bound, high_bound )( engine );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement