Hi everyone!
I need to use random_device for generating non deterministic random numbers, but
I don't know how to use this class, it's very confusing, I don't understand it.
I'm using linux.
My example code:
using namespace std;
#include <iostream>
#include <string>
#include
AMDG Raphael MD wrote:
I need to use random_device for generating non deterministic random numbers, but
I don't know how to use this class, it's very confusing, I don't understand it.
I'm using linux.
My example code:
using namespace std; #include <iostream> #include <string> #include
#include int main() { boost::random_device::result_type min(1); boost::random_device::result_type max(60); boost::random_device dev; }
Thanks for help.
I assume you want to generate numbers in the range [1,60]? All generators including random_device produce values is a predefined range. To produce values in the range you want, use uniform_int. There's an example at http://www.boost.org/doc/libs/1_44_0/doc/html/boost_random/tutorial.html. It uses mt19937, but the usage with random_device is the same. In Christ, Steven Watanabe
participants (2)
-
Raphael MD
-
Steven Watanabe