POV-Ray : Newsgroups : povray.binaries.images : Question on introducing randomness. : Re: Question on introducing randomness. Server Time
18 Aug 2024 08:28:35 EDT (-0400)
  Re: Question on introducing randomness.  
From: Lutz-Peter Hooge
Date: 13 May 2001 04:56:31
Message: <MPG.15686ad8ca7d15299896b2@news.povray.org>
In article <3afe4401$1@news.povray.org>, tla### [at] homecom says...
> Thanks for the info! I'm trying to find out how to create random numbers
> between -0.75 and 0.75. I tried to come up with the function using your
> examples but I can't seem to get it right. The general for seems to be

This macro returns a random number between R_min and R_max
in your case use random(MySeed,-0.75,0.75)

#macro random(Myseed,R_min,R_max)
	(rand(MySeed)*(R_max-R_min) + R_min)
#end


> Num = rand*x + y
> so

> -0.75 = 0.1*x +y and
> 0.75 = 0.9*x +y
Wrong. 
-0.75 = 0*x+y
0.75 = 1*x+y

so
y = -0.75  // = R_min
x = 2*0.75 = 0.75 - (-0.75) // = R_max - R_min

Lutz-Peter


Post a reply to this message

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