Assume that b.size() <= N-1 */
| 67 | |
| 68 | /** Assume that b.size() <= N-1 */ |
| 69 | void pick_rand_breaks(std::vector<int>& b, int N, boost::uniform_01<boost::mt19937>& X) |
| 70 | { |
| 71 | int num_breaks = b.size(); |
| 72 | if (num_breaks > N-1) return; |
| 73 | |
| 74 | std::set<int> s; |
| 75 | while (s.size() != num_breaks) s.insert(1 + (N-1)*X()); |
| 76 | int cnt=0; |
| 77 | for (std::set<int>::iterator it=s.begin(); it != s.end(); it++) { |
| 78 | b[cnt++] = *it; |
| 79 | } |
| 80 | std::sort(b.begin(), b.end()); |
| 81 | } |
| 82 | |
| 83 | // translate unique value breaks into normal breaks given unique value mapping |
| 84 | void unique_to_normal_breaks(const std::vector<int>& u_val_breaks, |
no test coverage detected