00001 /* hashRandom.h 00002 */ 00003 #ifndef OSL_HASHRANDOMPAIR_H 00004 #define OSL_HASHRANDOMPAIR_H 00005 00006 #include "osl/hash/hashKey.h" 00007 00008 namespace osl 00009 { 00010 namespace hash 00011 { 00012 class HashRandomPair 00013 { 00014 public: 00015 static const size_t Length = 0x100000; 00016 private: 00017 static std::pair<char,char> table[Length]; 00018 static bool is_initialized; 00019 public: 00020 static void setUp(unsigned int seed, unsigned int prob100); 00021 static std::pair<char,char> value(size_t key) 00022 { 00023 return table[key % Length]; 00024 } 00025 static std::pair<char,char> value(const HashKey& key) 00026 { 00027 return value(key.signature()); 00028 } 00029 static bool initialized() { return is_initialized; } 00030 }; 00031 } 00032 using hash::HashRandomPair; 00033 } 00034 00035 #endif /* OSL_HASHRANDOMPAIR_H */ 00036 // ;;; Local Variables: 00037 // ;;; mode:c++ 00038 // ;;; c-basic-offset:2 00039 // ;;; End: