18 #ifndef LUNCHBOX_RNG_H    19 #define LUNCHBOX_RNG_H    21 #include <boost/noncopyable.hpp>    23 #include <lunchbox/debug.h>     24 #include <lunchbox/init.h>      43 class RNG : 
public boost::noncopyable
    64         if (!_get(&value, 
sizeof(T)))
    70     LUNCHBOX_API 
bool _get(
void* data, 
size_t size);
    76     const float max_limits =
    77         static_cast<float>(std::numeric_limits<uint32_t>::max());
    78     return ((
float)get<uint32_t>() / max_limits);
    84     const double max_limits =
    85         static_cast<double>(std::numeric_limits<uint64_t>::max());
    86     return ((
double)get<uint64_t>() / max_limits);
    92     return (get<uint32_t>() & 1);
    95 #endif // LUNCHBOX_RNG_H Basic type definitions not provided by the operating system. 
 
A random number generator. 
 
Abstraction layer and common utilities for multi-threaded programming. 
 
T get()
Generate a random number.