From d2e2551472f306b8628284d5b12758dc159814a0 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 19 Oct 2023 17:40:31 +0000 Subject: Clean up random number generation git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4763 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- generator/pamcrater.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'generator') 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) { } + -- cgit 1.4.1