about summary refs log tree commit diff
path: root/editor/pbmreduce.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-10-02 03:42:10 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-10-02 03:42:10 +0000
commit0bf54ddfa2a0efcf6142ad1292abbfa26fe0bee3 (patch)
tree5e1255181517b72c3c5670da6be95e5ba8624614 /editor/pbmreduce.c
parent9184208ec40610f6856907fa00d814ae093d3e3b (diff)
downloadnetpbm-mirror-0bf54ddfa2a0efcf6142ad1292abbfa26fe0bee3.tar.gz
netpbm-mirror-0bf54ddfa2a0efcf6142ad1292abbfa26fe0bee3.tar.xz
netpbm-mirror-0bf54ddfa2a0efcf6142ad1292abbfa26fe0bee3.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@82 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pbmreduce.c')
-rw-r--r--editor/pbmreduce.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/editor/pbmreduce.c b/editor/pbmreduce.c
index 15ec2a1b..f49c8d9a 100644
--- a/editor/pbmreduce.c
+++ b/editor/pbmreduce.c
@@ -91,21 +91,22 @@ main( argc, argv )
     pbm_writepbminit( stdout, newcols, newrows, 0 );
     newbitrow = pbm_allocrow( newcols );
 
-    if ( halftone == QT_FS ) {
+    if (halftone == QT_FS) {
+        unsigned int col;
         /* Initialize Floyd-Steinberg. */
         MALLOCARRAY(thiserr, newcols + 2);
         MALLOCARRAY(nexterr, newcols + 2);
-        if ( thiserr == NULL || nexterr == NULL )
-          pm_error( "out of memory" );
+        if (thiserr == NULL || nexterr == NULL)
+            pm_error("out of memory");
 
-        srand( (int) ( time( 0 ) ^ getpid( ) ) );
-        for ( col = 0; col < newcols + 2; ++col )
-          thiserr[col] = ( rand( ) % SCALE - HALFSCALE ) / 4;
+        srand(pm_randseed());
+        for (col = 0; col < newcols + 2; ++col)
+            thiserr[col] = (rand() % SCALE - HALFSCALE) / 4;
 	    /* (random errors in [-SCALE/8 .. SCALE/8]) */
 	} else {
         /* These variables are meaningless in this case, and the values
            should never be used.
-           */
+        */
         thiserr = NULL;
         nexterr = NULL;
     }