option '-s' run srand(getpid())
This commit is contained in:
parent
495a7cf3cf
commit
474814ad11
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
|
|
||||||
@ -15,16 +16,17 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "v")) != -1) {
|
while ((opt = getopt(argc, argv, "vs")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'v': verbosity++; break;
|
case 'v': verbosity++; break;
|
||||||
default: break;
|
case 's': srand(getpid()); break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbosity > 1)
|
if (verbosity > 1) {
|
||||||
fprintf(stderr, "fake values - %s %s\n", __DATE__, __TIME__);
|
fprintf(stderr, "fake values - %s %s\n", __DATE__, __TIME__);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
printf("%f %d\n", dtime(), random1000(0));
|
printf("%f %d\n", dtime(), random1000(0));
|
||||||
|
Loading…
Reference in New Issue
Block a user