about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-11-24 21:10:39 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-11-24 21:10:39 +0000
commit02ebc3456f8a282920583d149c7b0a1ef78aee64 (patch)
treec8d02583cc46f156333ca3a82c7129e3ecf1c912
parente2587d242781506d62ca74c9c3ab96a07d225bce (diff)
downloadnetpbm-mirror-02ebc3456f8a282920583d149c7b0a1ef78aee64.tar.gz
netpbm-mirror-02ebc3456f8a282920583d149c7b0a1ef78aee64.tar.xz
netpbm-mirror-02ebc3456f8a282920583d149c7b0a1ef78aee64.zip
Add -randomseed
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1783 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--editor/pamrecolor.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/editor/pamrecolor.c b/editor/pamrecolor.c
index d7bcaa0f..6937fd8d 100644
--- a/editor/pamrecolor.c
+++ b/editor/pamrecolor.c
@@ -64,6 +64,8 @@ struct cmdlineInfo {
         */
     unsigned int    targetcolorSpec;
     struct rgbfrac  targetcolor;
+    unsigned int    randomseed;
+    unsigned int    randomseedSpec;
 };
 
 
@@ -375,6 +377,8 @@ parseCommandLine(int argc, const char ** const argv,
             &colorfileSpec, 0);
     OPTENT3(0, "targetcolor",  OPT_STRING, &targetcolorOpt,
             &cmdlineP->targetcolorSpec, 0);
+    OPTENT3(0,   "randomseed",   OPT_UINT,    &cmdlineP->randomseed,
+            &cmdlineP->randomseedSpec,      0);
 
     opt.opt_table = option_def;
     opt.short_allowed = 0;
@@ -456,10 +460,10 @@ main(int argc, const char *argv[]) {
 
     pm_proginit(&argc, argv);
 
-    srand(pm_randseed());
-
     parseCommandLine(argc, argv, &cmdline);
 
+    srand(cmdline.randomseedSpec ? cmdline.randomseed : pm_randseed());
+
     ifP = pm_openr(cmdline.inputFileName);
     inPam.comment_p = &comments;
     pnm_readpaminit(ifP, &inPam, PAM_STRUCT_SIZE(comment_p));