CyberTR
CyberTR

Reputation: 71

How to generate random numbers with rand() without time.h in C

How to generate random numbers with rand() and srand() without time.h in C ?

Upvotes: 0

Views: 2730

Answers (1)

Zenorbi
Zenorbi

Reputation: 2634

You could try givin another seed to the random generator like the program's pid.

srand(getpid());
int num = rand();

Upvotes: 3

Related Questions