random.h
Go to the documentation of this file.
00001 #ifndef OSL_RANDOM_H
00002 #define OSL_RANDOM_H
00003 namespace osl
00004 {
00005   namespace misc
00006   {
00007     unsigned int random();
00008     unsigned int time_seeded_random();
00009     template<typename T>
00010     struct Random;
00011     template<>
00012     struct Random<unsigned int>{
00013       static unsigned int newValue(){
00014         return random();
00015       }
00016     };
00017     template<>
00018     struct Random<unsigned long long>{
00019       static unsigned long long newValue(){
00020         return (static_cast<unsigned long long>(random())<<32ull)|
00021           static_cast<unsigned long long>(random());
00022       }
00023     };
00024   } // namespace misc
00025   using osl::misc::random;
00026   using osl::misc::time_seeded_random;
00027 } // namespace osl
00028 #endif /* _RANDOM_H */
00029 // ;;; Local Variables:
00030 // ;;; mode:c++
00031 // ;;; c-basic-offset:2
00032 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines