<p>If I have srand(2) declared in my main of my driver file,
do I need to declare srand(2) in my code file which is being linked with my driver?</p>

<p>Thanks.</p>

<p><strong>edit</strong></p>

<p>(from user's comment below)</p>

<p>If I do,</p>

<pre><code>srand(2);
srand(2);
</code></pre>

<p>will I get the seed as 2? or something else?</p>

I think you'll have to clarify your question a bit more, but in general, you have to declare (but not define) every function you use in a given translation unit.  If you want to use srand in a .cpp file, you'll have to
```
#include <stdlib.h>
```
in that file.
For the usage of srand - take a look at its
documentation
.  You'll usually only need to call it once in a given process, after which you can expect the same sequence of pseudo-random values each run.  Calling it again with the same seed will restart the sequence of values.  If you're wanting different values each run, try seeding with the current time.
EDIT:
Do you mean that you have two files something like this:
```
```
// Driver.cpp
#include <stdlib.h>
#include "otherfile.h"

int main()
{
    srand(2);
    Somefunc();
}
```
```
And then another file linked in:
```
```
// OtherFile.cpp
#include <stdlib.h>
#include "otherfile.h"

void SomeFunc()
{
    // You don't need to call srand() here, since it's already been called in driver.cpp
   int j = rand();
}
```
```