about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-10-19 17:40:31 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-10-19 17:40:31 +0000
commitd2e2551472f306b8628284d5b12758dc159814a0 (patch)
treea26303f52bfc064c0cd171bf9a5b06c6a47ab267
parent8d8ce29e24eea1bcb2fe6a27c8bc4d2a67b06454 (diff)
downloadnetpbm-mirror-d2e2551472f306b8628284d5b12758dc159814a0.tar.gz
netpbm-mirror-d2e2551472f306b8628284d5b12758dc159814a0.tar.xz
netpbm-mirror-d2e2551472f306b8628284d5b12758dc159814a0.zip
Clean up random number generation
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4763 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--generator/pamcrater.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/generator/pamcrater.c b/generator/pamcrater.c
index b8ceafa5..8f0e422d 100644
--- a/generator/pamcrater.c
+++ b/generator/pamcrater.c
@@ -163,7 +163,6 @@ parseCommandLine(int argc, const char ** const argv,
 
 
 
-static double const arand       = 32767.0;  /* Random number parameters */
 static double const CdepthPower = 1.5;      /* Crater depth power factor */
 static double const DepthBias2  = 0.5;      /* Square of depth bias */
 
@@ -175,7 +174,7 @@ cast(double             const high,
 /*----------------------------------------------------------------------------
    A random number in the range [0, 'high'].
 -----------------------------------------------------------------------------*/
-    return high * ((pm_rand(randStP) & 0x7FFF) / arand);
+  return high * ((double) pm_rand(randStP) / randStP->max);
 }
 
 
@@ -222,7 +221,6 @@ terrainModP(struct pam * const pamP,
 
 
 
-
 static sample
 terrainMod(struct pam * const pamP,
            tuple **     const terrain,
@@ -522,3 +520,4 @@ main(int argc, const char ** argv) {
 }
 
 
+