diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-09-27 21:44:29 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-09-27 21:44:29 +0000 |
commit | 43939e66b1d4eeb2f3799c124f3598756755005a (patch) | |
tree | 15733092de55d52421a6ea02f5a43d5f8ff24393 /lib/libppmfloyd.c | |
parent | 49f4336c9bba33650573ba780b70bc501b38643e (diff) | |
download | netpbm-mirror-43939e66b1d4eeb2f3799c124f3598756755005a.tar.gz netpbm-mirror-43939e66b1d4eeb2f3799c124f3598756755005a.tar.xz netpbm-mirror-43939e66b1d4eeb2f3799c124f3598756755005a.zip |
Rebase Stable series to current Advanced: 10.47.04
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@995 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; } |