--- /dev/null
+
+#ifndef _KEY_MANAGER_H_
+#define _KEY_MANAGER_H_
+
+#include <list>
+#include "random.h"
+
+template <class T>
+class KeyManager {
+ public:
+ KeyManager ()
+ {
+ altas = 0;
+ bajas = 0;
+ }
+
+ void AddValue (T k)
+ {
+ keys.push_back (k);
+ altas ++;
+ }
+
+ T GetRandom ()
+ {
+ int l = 0;
+ int n = (int)Random::Double (0, keys.size ());
+
+ typename std::list< T >::iterator it = keys.begin ();
+ while (l < n) {
+ l++;
+ it++;
+ }
+
+ T ret = (*it);
+
+ keys.erase (it);
+
+ bajas ++;
+ return ret;
+ }
+
+ void PrintInfo ()
+ {
+ std::cout << "Cantidad de Altas : " << altas << std::endl;
+ std::cout << "Cantidad de Bajas : " << bajas << std::endl;
+ }
+
+ std::list < T >& GetList () { return keys; }
+ private:
+ std::list< T > keys;
+ int altas;
+ int bajas;
+};
+
+#endif
+