00001
00002 #ifndef _INSTIGATE_STL_INTERNAL_HEADER_IN_ALGORITHM
00003 #error This is an internal header file used to implement Instigate STL.\
00004 It should never be included directly by a program.
00005 #endif
00006
00007 #ifndef INSTIGATE_STL_RANDOM_NUMBER_HPP
00008 #define INSTIGATE_STL_RANDOM_NUMBER_HPP
00009
00059
00060
00061
00062
00063
00064 #include <cstdlib>
00065
00066
00067 namespace instigate {
00068 namespace stl {
00069 template <typename D>
00070 inline D random_number(D n);
00071 }
00072 }
00073
00081 template <typename D>
00082 inline D instigate::stl::random_number(D n)
00083 {
00084 #ifndef _STL_NO_DRAND48
00085 return std::rand() % n;
00086 #else
00087 return lrand48() % n;
00088 #endif
00089 }
00090
00091
00092
00093 #endif // INSTIGATE_STL_RANDOM_NUMBER_HPP