Check out example codes for "rand()". It will help you in understanding the concepts better.

Code Example 1

v1 = rand() % 100;         // v1 in the range 0 to 99
v2 = rand() % 100 + 1;     // v2 in the range 1 to 100
v3 = rand() % 30 + 1985;   // v3 in the range 1985-2014

Code Example 2

//Remember to use srand() between
//rand()'s to change the seed:

#include <cstdlib>
#include <ctime>

std::srand(time(NULL));

int variable = rand();

Code Example 3

#include <cstdlib>
#include <iostream>
#include <ctime>
 
int main() 
{
    std::srand(std::time(nullptr)); // use current time as seed for random generator
    int random_variable = std::rand();
    std::cout << "Random value on [0 " << RAND_MAX << "]: " 
              << random_variable << '\n';
}

Code Example 4

rand() % (max_number + 1 - minimum_number) + minimum_number

Code Example 5

you can use rand() function for that in php.
Example:
Generate random numbers between 1 to 50
<?php
  echo rand(1,50);
?>

Code Example 6

<?php
  echo rand(1,50);
?>

Learn ReactJs, React Native from akashmittal.com