2 ***********************************************************
3 $SNARK_Header: S N A R K 1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/get_seed.c $
5 $LastChangedRevision: 118 $
6 $Date: 2014-07-09 14:22:29 -0400 (Wed, 09 Jul 2014) $
8 ***********************************************************
10 Previously part of SuperSNARK
12 * Feb 13, 2011 Joanna Klukowska
13 * This file is no longer user. A single seed for snark14 experimenter run
14 * is provided in the input file, or based on time (if the input file does not
21 #include "experimenter.h"
25 /*---------------------------- get_seed.c ---------------------------------
26 This function checks the file specified on line 3 of the
27 SuperSNARK input sequence and obtaines the seed value (if it is
31 proj_flname - name of file containing information about generation of the
32 projection data. This is the file specified on line 3 of the
33 SuperSNARK input sequence.
34 seed - seed generated by current time.
37 seed - seed to be used in random number generator.
38 ----------------------------------------------------------------------------*/
40 void get_seed(char* proj_flname, long* seed)
42 char string[MAXLINESIZE], line[MAXLINESIZE];
46 if ((projfl = fopen(proj_flname, "r")) == NULL)
48 errorc("error in opening file", proj_flname);
51 while ((fgets(string, sizeof(string), projfl)) != NULL)
53 if (strncasecmp(string, "seed", 4) == 0)
55 /* if string has 'seed' then ... */
56 if (sscanf(string, "%s %ld", line, &inseed) == 2)
60 //else if inseed < 0 use the current time as seed
64 //if number not specified, the default = 0