about summary refs log tree commit diff
path: root/editor
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-02-13 00:27:43 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-02-13 00:27:43 +0000
commit5edf1a5ab1b4de785323dd96368972b8dad1a1e5 (patch)
treeb01022bc06bb1f67f98a885c47ba6f516cbb0cf6 /editor
parent6a233b0f40bb4590fc70f3e24e49627ef504ce39 (diff)
downloadnetpbm-mirror-5edf1a5ab1b4de785323dd96368972b8dad1a1e5.tar.gz
netpbm-mirror-5edf1a5ab1b4de785323dd96368972b8dad1a1e5.tar.xz
netpbm-mirror-5edf1a5ab1b4de785323dd96368972b8dad1a1e5.zip
Use rand() and srand() instead of random() and srandom() because the latter are not present in Mingw builds
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1646 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rw-r--r--editor/pamrecolor.c9
-rw-r--r--editor/specialty/pampaintspill.c5
2 files changed, 6 insertions, 8 deletions
diff --git a/editor/pamrecolor.c b/editor/pamrecolor.c
index 51fc30c4..d7bcaa0f 100644
--- a/editor/pamrecolor.c
+++ b/editor/pamrecolor.c
@@ -24,7 +24,6 @@
  * ----------------------------------------------------------------------
  */
 
-#define _XOPEN_SOURCE 600  /* Make sure random(), srandom() are in <stdlib.h>*/
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -181,9 +180,9 @@ randomlyColorRow(struct pam *   const pamP,
     unsigned int col;
 
     for (col = 0; col < pamP->width; ++col) {
-        rowData[col][PAM_RED_PLANE] = random() / (float)RAND_MAX;
-        rowData[col][PAM_GRN_PLANE] = random() / (float)RAND_MAX;
-        rowData[col][PAM_BLU_PLANE] = random() / (float)RAND_MAX;
+        rowData[col][PAM_RED_PLANE] = rand() / (float)RAND_MAX;
+        rowData[col][PAM_GRN_PLANE] = rand() / (float)RAND_MAX;
+        rowData[col][PAM_BLU_PLANE] = rand() / (float)RAND_MAX;
     }
 }
 
@@ -457,7 +456,7 @@ main(int argc, const char *argv[]) {
 
     pm_proginit(&argc, argv);
 
-    srandom(pm_randseed());
+    srand(pm_randseed());
 
     parseCommandLine(argc, argv, &cmdline);
 
diff --git a/editor/specialty/pampaintspill.c b/editor/specialty/pampaintspill.c
index f9fe53c4..745c9b68 100644
--- a/editor/specialty/pampaintspill.c
+++ b/editor/specialty/pampaintspill.c
@@ -37,7 +37,6 @@
   10.04.14
 */
 
-#define _XOPEN_SOURCE 600  /* Make sure random(), srandom() are in <stdlib.h>*/
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -254,11 +253,11 @@ locatePaintSources(struct pam *            const pamP,
     if (downsample > 0 && downsample < paintSources.size) {
         unsigned int i;
 
-        srandom(time(NULL));
+        srand(time(NULL));
 
         for (i = 0; i < downsample; ++i) {
             unsigned int const swapIdx =
-                i + random() % (paintSources.size - i);
+                i + rand() % (paintSources.size - i);
             struct coords const swapVal = paintSources.list[i];
 
             paintSources.list[i] = paintSources.list[swapIdx];