#include <iostream>
#include <cstdlib>
#include <time.h>

using namespace std;

int main() {
  srand((unsigned)time(NULL));

  int rnda = int((double(rand())/RAND_MAX)*50);
  int rndb = int((double(rand())/RAND_MAX)*75) + 25;

  cout << "Number between 0 and 50: " << rnda << endl;
  cout << "Number between 25 and 100: " << rndb << endl;

  return 0;
}
Published in: C++
Download

Related snippets