| 145 | } |
| 146 | filepath n2; |
| 147 | const char *get_random_sub() { |
| 148 | ceph_assert(!contents.empty()); |
| 149 | int r = ((rand() % contents.size()) + (rand() % contents.size())) / 2; // non-uniform distn |
| 150 | if (cwd.depth() && cwd.last_dentry().length()) |
| 151 | r += cwd.last_dentry().c_str()[0]; // slightly permuted |
| 152 | r %= contents.size(); |
| 153 | |
| 154 | std::map<std::string,struct stat*>::iterator it = contents.begin(); |
| 155 | while (r--) ++it; |
| 156 | |
| 157 | n2 = cwd; |
| 158 | n2.push_dentry( it->first ); |
| 159 | return n2.get_path().c_str(); |
| 160 | } |
| 161 | |
| 162 | filepath sub; |
| 163 | char sub_s[50]; |