All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
random.h
Go to the documentation of this file.
1 #ifndef OSL_RANDOM_H
2 #define OSL_RANDOM_H
3 namespace osl
4 {
5  namespace misc
6  {
7  unsigned int random();
8  unsigned int time_seeded_random();
9  template<typename T>
10  struct Random;
11  template<>
12  struct Random<unsigned int>{
13  static unsigned int newValue(){
14  return random();
15  }
16  };
17  template<>
18  struct Random<unsigned long long>{
19  static unsigned long long newValue(){
20  return (static_cast<unsigned long long>(random())<<32ull)|
21  static_cast<unsigned long long>(random());
22  }
23  };
24  } // namespace misc
25  using osl::misc::random;
27 } // namespace osl
28 #endif /* _RANDOM_H */
29 // ;;; Local Variables:
30 // ;;; mode:c++
31 // ;;; c-basic-offset:2
32 // ;;; End: