hashRandomPair.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hashRandomPair.h
Go to the documentation of this file.
1 /* hashRandom.h
2 */
3 #ifndef OSL_HASHRANDOMPAIR_H
4 #define OSL_HASHRANDOMPAIR_H
5
6 #include "osl/hash/hashKey.h"
7
8 namespace osl
9 {
10 namespace hash
11 {
12 class HashRandomPair
13 {
14 public:
15 static const size_t Length = 0x100000;
16 private:
17 static std::pair<char,char> table[Length];
18 static bool is_initialized;
19 public:
20 static void setUp(unsigned int seed, unsigned int prob100);
21 static std::pair<char,char> value(size_t key)
22 {
23 return table[key % Length];
24 }
25 static std::pair<char,char> value(const HashKey& key)
26 {
27 return value(key.signature());
28 }
29 static bool initialized() { return is_initialized; }
30 };
31 }
32 using hash::HashRandomPair;
33 }
34
35 #endif /* OSL_HASHRANDOMPAIR_H */
36 // ;;; Local Variables:
37 // ;;; mode:c++
38 // ;;; c-basic-offset:2
39 // ;;; End: