POV-Ray : Newsgroups : povray.advanced-users : Random variation : Re: Random variation Server Time
29 Jul 2024 14:14:36 EDT (-0400)
  Re: Random variation  
From: Warp
Date: 27 Sep 2002 11:54:18
Message: <3d947f2a@news.povray.org>
Christopher James Huff <chr### [at] maccom> wrote:
>>   I wonder if an approach like the drand48() function would be better.

> What approach would that be?

  From the drand48 man page:

     Functions  drand48()  and  erand48()   return   non-negative
     double-precision floating-point values uniformly distributed
     over the interval [0.0, 1.0].
[snip]

     All the routines work by generating  a  sequence  of  48-bit
     integer  values,  Xi  , according to the linear congruential
     formula

           X n+1= (aX n+c)  mod m n>=0.

     The parameter m = 2**48; hence 48-bit integer arithmetic  is
     performed. Unless lcong48() has been invoked, the multiplier
     value a and the addend value c are given by

               a = 5DEECE66D16 = 2736731631558
               c = B16 = 138 .

     The value  returned  by  any  of  the  functions  drand48(),
     erand48(),  lrand48(), nrand48(), mrand48(), or jrand48() is
     computed by first generating  the  next  48-bit  Xi  in  the
     sequence.  Then the appropriate number of bits, according to
     the type of data item to be returned, are  copied  from  the
     high-order  (leftmost)  bits  of Xi and transformed into the
     returned value.

     The functions drand48(), lrand48(), and mrand48() store  the
     last  48-bit  Xi generated in an internal buffer. Xi must be
     initialized prior to being invoked.
[snip]

     The initializer function srand48() sets  the  high-order  32
     bits  of  Xi  to  the 32 bits contained in its argument. The
     low-order 16 bits of Xi  are  set  to  the  arbitrary  value
     330E16 .


-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.