diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-12-31 08:08:29 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-12-31 08:08:29 +0000 |
commit | 31fc573df625b06a5f7b8b8e769e9f35cbfdaf91 (patch) | |
tree | caf153af4ea24150e1f54e77c35b9ee51e727055 /lib/libppmfloyd.c | |
parent | 2cc04cae07f40a7c58616e4614e88cf0ae8e63c7 (diff) | |
download | netpbm-mirror-31fc573df625b06a5f7b8b8e769e9f35cbfdaf91.tar.gz netpbm-mirror-31fc573df625b06a5f7b8b8e769e9f35cbfdaf91.tar.xz netpbm-mirror-31fc573df625b06a5f7b8b8e769e9f35cbfdaf91.zip |
Release 10.37.0
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@187 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/libppmfloyd.c')
-rw-r--r-- | lib/libppmfloyd.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/libppmfloyd.c b/lib/libppmfloyd.c index 071c3c36..ec6256ff 100644 --- a/lib/libppmfloyd.c +++ b/lib/libppmfloyd.c @@ -85,35 +85,36 @@ allocateFi(int const cols) { ppm_fs_info * -ppm_fs_init(int cols, pixval maxval, int flags) { +ppm_fs_init(unsigned int const cols, + pixval const maxval, + unsigned int const flags) { - ppm_fs_info *fi; + ppm_fs_info * fiP; - fi = allocateFi(cols); + fiP = allocateFi(cols); - fi->lefttoright = 1; - fi->cols = cols; - fi->maxval = maxval; - fi->flags = flags; - - if( flags & FS_RANDOMINIT ) { + fiP->lefttoright = 1; + fiP->cols = cols; + fiP->maxval = maxval; + fiP->flags = flags; + + if (flags & FS_RANDOMINIT) { unsigned int i; - srand((int)(time(0) ^ getpid())); - for( i = 0; i < cols +2; i++ ) { + srand(pm_randseed()); + for (i = 0; i < cols +2; ++i) { /* random errors in [-1..+1] */ - fi->thisrederr[i] = rand() % 32 - 16; - fi->thisgreenerr[i] = rand() % 32 - 16; - fi->thisblueerr[i] = rand() % 32 - 16; + fiP->thisrederr[i] = rand() % 32 - 16; + fiP->thisgreenerr[i] = rand() % 32 - 16; + fiP->thisblueerr[i] = rand() % 32 - 16; } - } - else { + } else { unsigned int i; - for( i = 0; i < cols + 2; i++ ) - fi->thisrederr[i] = fi->thisgreenerr[i] = - fi->thisblueerr[i] = 0; + for (i = 0; i < cols + 2; ++i) + fiP->thisrederr[i] = fiP->thisgreenerr[i] = + fiP->thisblueerr[i] = 0; } - return fi; + return fiP; } |