Just As title . As least I know array might not be one I want . cus I need to generate a random index before I want to randomly pick up one item from the array . For your opinion.
I've change the title of my question to "which stl container I should choose If I need to random get an item from the container" . what I really find is a cotain , let's say C , and this Contain should have method , let's say, get_ramdom_member(), which will help me get an item randomly from the Container C without providing any key .
@binary: what I store in the container is actually socket fd . the other side of the socket is an "erlang node" . several erlang node togerther serves as a cluster . So I store all the socket fds towards that cluster into one container . Every time I need to talk to the cluster , I need choose one fd . For the purpose of load sharing, I need to randomly get one . I can't tell you guys exactly number of fd the Container need to maintain , but currently it is less than 10 at the moment. but who knows whether the number will be 1000 some day later on .