Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

random number in a range c++

int random(int min, int max) {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> gen(min, max);
    int a = gen(rng);
    return a;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #random #number #range
ADD COMMENT
Topic
Name
1+3 =