| 204 | } |
| 205 | |
| 206 | bool PartioSe::runRandom(){ |
| 207 | countVar.val=parts->numParticles(); |
| 208 | if(!isValid()){ |
| 209 | std::cerr<<"Not running expression because it is invalid"<<std::endl; |
| 210 | std::cerr<<parseError()<<std::endl; |
| 211 | return false; |
| 212 | } |
| 213 | std::vector<int> order(parts->numParticles()); |
| 214 | for(size_t i=0;i<order.size();i++) order[i]=i; |
| 215 | for(size_t i=0;i<order.size();i++){ |
| 216 | size_t other=float(rand())/RAND_MAX*order.size(); |
| 217 | if(other>=order.size()) other=order.size()-1; |
| 218 | std::swap(order[i],order[other]); |
| 219 | } |
| 220 | for(size_t i=0;i<order.size();i++){ |
| 221 | run(order[i]); |
| 222 | } |
| 223 | return true; |
| 224 | } |
| 225 | |
| 226 | SeExprVarRef* PartioSe::resolveVar(const std::string& s) const{ |
| 227 | { |
nothing calls this directly
no test coverage detected