Random element in a map

前端 未结 9 613
面向向阳花
面向向阳花 2021-01-07 16:14

what is a good way to select a random element from a map? C++. It is my understanding that maps don\'t have random access iterators. The key is a long long and the map is

9条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-07 16:50

    Has anyone tried this? https://github.com/mabdelazim/Random-Access-Map "C++ template class for random access map. This is like the std::map but you can access items random by index with syntax my_map.key(i) and my_map.data(i)"

提交回复
热议问题