POV-Ray : Newsgroups : povray.newusers : seed : Re: seed Server Time
5 Nov 2024 09:23:14 EST (-0500)
  Re: seed  
From: Margus Ramst
Date: 24 Feb 2000 08:26:32
Message: <38B53204.92AA285A@peak.edu.ee>
Chris Huff wrote:
> 
> Not "random()", "rand()". But this gives me an idea...
> 

Two macros that do the same, used & tested:

//Create random number of given mean and maximum deviation
//M - mean value
//D - maximum deviation
//Seed - (declared) random number seed identifier
#macro rand_ext(M,D,Seed)
        (M+(rand(Seed)-.5)*2*D)
#end

//Give a random vector of given mean and max deviation
//M - mean (vector or float)
//D - max deviation (vector or float)
//Seed - (declared) random number seed identifier
#macro v_rand_ext(M,D,Seed)
        #local MV=M+<0,0,0>;
        #local DV=D+<0,0,0>;
(<rand_ext(MV.x,DV.x,Seed),rand_ext(MV.y,DV.y,Seed),rand_ext(MV.z,DV.z,Seed)>)
#end


Post a reply to this message

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