Updated the getCache() method to actually pick a random client from the
authorPadraig O'Sullivan <osullivan.padraig@gmail.com>
Sat, 19 Sep 2009 17:04:38 +0000 (13:04 -0400)
committerPadraig O'Sullivan <osullivan.padraig@gmail.com>
Sat, 19 Sep 2009 17:04:38 +0000 (13:04 -0400)
vector of clients.

tests/cpp_example.cc

index a9977ca7293aa09c11f3c192047979a789a9aeee..5454f0203512651c7fe392719b9351dc22e93cc9 100644 (file)
@@ -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: