18 #ifndef LUNCHBOX_RNG_H
19 #define LUNCHBOX_RNG_H
21 #include <lunchbox/debug.h>
22 #include <lunchbox/init.h>
23 #include <lunchbox/nonCopyable.h>
30 namespace detail {
class RNG; }
48 LUNCHBOX_API
void reseed();
58 template<
typename T > T
get()
61 if( !_get( &value,
sizeof( T )))
67 detail::RNG*
const _impl;
69 static LUNCHBOX_API
bool _init();
71 friend LUNCHBOX_API
bool init(
const int argc,
char** argv );
72 LUNCHBOX_API
bool _get(
void* data,
size_t size );
77 const float max_limits =
78 static_cast< float >( std::numeric_limits< uint32_t >::max( ));
79 return ( get< uint32_t >() / max_limits);
84 const double max_limits =
85 static_cast< double >( std::numeric_limits< uint64_t >::max( ));
86 return ( get< uint64_t >() / max_limits);
91 return ( get< uint32_t >() & 1 );
94 #endif // LUNCHBOX_RNG_H