hashRandom.h
Go to the documentation of this file.
00001 /* hashRandom.h
00002  */
00003 #ifndef OSL_HASHRANDOM_H
00004 #define OSL_HASHRANDOM_H
00005 
00006 #include "osl/hash/hashKey.h"
00007 #include "osl/misc/carray.h"
00008 
00009 namespace osl
00010 {
00011   namespace hash
00012   {
00013     class HashRandom
00014     {
00015     public:
00016       static const size_t Length = 0x1000;
00017     private:
00018       static CArray<int,Length> table;
00019     public:
00020       static void setUp(double sigma);
00021       static int value(size_t key) 
00022       {
00023         return table[key % Length];
00024       }
00025       static int value(const HashKey& key) 
00026       {
00027         return value(key.signature());
00028       }
00029     };
00030   }
00031   using hash::HashRandom;
00032 }
00033 
00034 #endif /* OSL_HASHRANDOM_H */
00035 // ;;; Local Variables:
00036 // ;;; mode:c++
00037 // ;;; c-basic-offset:2
00038 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines