lundi 21 octobre 2019

C++ Random Number Generator with dynamic range

Hey I'm new a wanted to know how I can create a random number generator within a given range that can be changed as code is run( say range starts as 0 to 1000, but later can be modified to 430-600)

I have something like this (v is max and i is min) Pls Help!

int range = (v - i )+ 1;
srand(time(0));
Guess = rand() % range+ i;



Aucun commentaire:

Enregistrer un commentaire