POV-Ray : Newsgroups : povray.general : Smooth random : Re: Smooth random Server Time
10 Aug 2024 23:28:10 EDT (-0400)
  Re: Smooth random  
From: Nieminen Juha
Date: 11 Oct 1999 06:05:15
Message: <3801b65b@news.povray.org>
Larry Fontaine <lfo### [at] isdnet> wrote:
: How can I get a smooth random number, ie, it varies from the last random
: number by no more than a certain amount?

  If you mean a linear distribution, that's pretty simple:

#declare Seed = seed(0);
#declare Number = rand(Seed);
#macro NextNumber(maxvariation)
  #declare Number = Number-maxVariation+maxvariation*rand(Seed)*2;
  Number
#end

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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