From: Padraig O'Sullivan Date: Sat, 19 Sep 2009 17:04:38 +0000 (-0400) Subject: Updated the getCache() method to actually pick a random client from the X-Git-Tag: 0.34~13^2~9 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=35e6d2153f62a0c69d05c1702b44f3f8e5df5cd4;p=awesomized%2Flibmemcached Updated the getCache() method to actually pick a random client from the vector of clients. --- diff --git a/tests/cpp_example.cc b/tests/cpp_example.cc index a9977ca7..5454f020 100644 --- a/tests/cpp_example.cc +++ b/tests/cpp_example.cc @@ -58,9 +58,12 @@ public: Memcache *getCache() { - /* pick a random element from the vector of clients */ - Memcache *first= clients[0]; - return first; + /* + * pick a random element from the vector of clients. Obviously, this is + * not very random but suffices as an example! + */ + uint32_t index= rand() % num_of_clients; + return clients[index]; } private: