[合集] C++ STL question# Programming - 葵花宝典
b*y
1 楼
☆─────────────────────────────────────☆
catbert (mimi) 于 (Thu Apr 28 15:53:57 2005) 提到:
Hi, how to randomly pick up an element from a set/map? Thanks!
☆─────────────────────────────────────☆
arya (死火山下) 于 (Thu Apr 28 16:02:52 2005) 提到:
*(container.begin() + rand() * container.size() / RAND_MAX)
☆─────────────────────────────────────☆
catbert (mimi) 于 (Thu Apr 28 16:08:21 2005) 提到:
But performance wise it's still the same as deferencing each step, right?
☆─────────────────────────
catbert (mimi) 于 (Thu Apr 28 15:53:57 2005) 提到:
Hi, how to randomly pick up an element from a set/map? Thanks!
☆─────────────────────────────────────☆
arya (死火山下) 于 (Thu Apr 28 16:02:52 2005) 提到:
*(container.begin() + rand() * container.size() / RAND_MAX)
☆─────────────────────────────────────☆
catbert (mimi) 于 (Thu Apr 28 16:08:21 2005) 提到:
But performance wise it's still the same as deferencing each step, right?
☆─────────────────────────