Did you try googling for “boost random number” first? Here’s the relevant part of their documentation generating boost random numbers in a range
You want something like this:
#include <time.h>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
std::time(0) gen;
int random_number(start, end) {
boost::random::uniform_int_distribution<> dist(start, end);
return dist(gen);
}
edit: this related question probably will answer most of your questions: why does boost::random return the same number each time?
solved Using boost to generate random numbers between 1 and 9999 [closed]