From 35e6d2153f62a0c69d05c1702b44f3f8e5df5cd4 Mon Sep 17 00:00:00 2001 From: Padraig O'Sullivan Date: Sat, 19 Sep 2009 13:04:38 -0400 Subject: [PATCH] Updated the getCache() method to actually pick a random client from the vector of clients. --- tests/cpp_example.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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: -- 2.30.2