```
#include <Stdafx.h>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
int rand_0toN1(int n);
int main()
{
int n, i;
int r;
srand(time(NULL)); // set a seed for random-number generation.
cout<< "Enter number of dice to roll: ";
cin>> n;
for(i = 1; i <= n; i++)
{
r = rand_0toN1(6) + 1;
cout<< r << " ";
}
system("pause");
return 0;
}
// random 0 to n1 function
int rand_0toN1(int n)
{
return rand() % n;
}
```

I'M having trouble understanding a few lines of this program, the first one is srand(time(NULL));

I'M assuming srand is the function so what is time in this code. Also, if this line is generating a random number where is it storing the number, I don't see a variable anywhere.

And the line r = rand_0toN1(6) + 1, what's the + 1 all about? Thanks.